Search code examples
ruby-on-railsrubycommand-lineenvironment-variablesbundler

Setting 'EDITOR' or 'BUNDLER_EDITOR' environment variable


I am trying to open up a gem in Sublime Text, unsuccessfully. I have Bundler installed. Here is what is happening.

In the command line:

$bundle open Devise
To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR

When I go to the Bundler website it says,

Open the source directory of the given bundled gem:

$ bundle open GEM

This opens the source directory of the provided GEM in your editor. For this to work the EDITOR or BUNDLER_EDITOR environment variable has to be set.

I am new to all of this. What are the specific steps to set my EDITOR or BUNDLER_EDITOR environment variables? I'm on a Mac, using Sublime Text.

Thank you.


Solution

  • Assuming you're using the bash shell, you'll want to edit either your ~/.bashrc or ~/.bash_profile with:

    export EDITOR=<editor name>
    

    Example, specifically for Sublime:

    export EDITOR='subl -w'
    

    See: Sublime OS X Command Line docs