Setting 'EDITOR' or 'BUNDLER_EDITOR' environment variable

Solution 1:

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

Solution 2:

As @sixty4bit mentioned,

export EDITOR='subl -w' 

will raise error for command bundle open gem_name

But if I use

export EDITOR='subl'

Then sublime will not write commit message to git commit correctly for command git commit.

So I think it is better to use this config:

export EDITOR="subl -w"
export BUNDLER_EDITOR="subl"