Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Jun 19 '13 at 18:09

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

1  
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. –  Greg Jun 19 '13 at 16:10

1 Answer 1

up vote 4 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 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

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

export PATH=$PATH:~/bin

Now restart Terminal.app (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 2.app 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.