Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I set Sublime Text as the editor for git commits in Mac OS X?

In my .zshrc I have:

export EDITOR='subl -w'

But, if I do:

bundle open devise

I get the error:

Could not run 'subl -w /Users/edwardandrews-hodgson/.rvm/gems/ruby-1.9.2-p320@neighbours/gems/devise-2.1.3'

How should I reference Sublime?

share|improve this question

migrated from Jun 19 '13 at 18:09

This question came from our site for professional and enthusiast programmers.

Can you launch Sublime Text by running subl -w manually? – Stefan Jun 19 '13 at 15:11
if the subl executable is not in your path, try using the full path in the editor environment variable – Joe Jun 19 '13 at 15:20
...or add the path to where the subl command is living. – TTM Jun 19 '13 at 16:10
up vote 5 down vote accepted

First, you'll need to create a soft link to the subl command. If you haven't already, create a personal bin directory:

mkdir ~/bin

then create the soft link:

ln -s "/Applications/Sublime Text" ~/bin/subl

Next, open your .zshrc and add the following to the end:

export PATH=$PATH:~/bin

Now restart (or whichever term program you're using) and you should be able to open any file in ST2 from the command line using the subl command. Since your $EDITOR variable is already set properly, bundle open devise should work as expected. Keep in mind that if you have the MacPorts version of Python installed, you'll need to open Sublime Text from the Finder before the command line subl command will work.

share|improve this answer
Fantastic - that was more complicated than I thought it would be! – Edward Jun 21 '13 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .