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.

I'm trying to get Sublime Text 2's command line alias working.

The instructions make perfect sense: Run

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

So, in ~/bin, subl exists. However, even when I restart terminal, the command 'subl' is not found. The path specified to the application's subl file is correct, I've verified that. Logging out does not fix it.

Any help would be awesome!

share|improve this question
1  
Have you added ~/bin/subl to your $PATH? –  Nifle Oct 26 '11 at 15:52
    
Sure haven't, I'm checking how to do this (first time for everything), but I'll gladly accept it in answer format! –  Gavin Oct 26 '11 at 15:55
    
@Gavin Do you have both .bash_profile and .bashrc or only the former? Are there other occurrences of PATH in either of these files (or wherever that ruby stuff is set)? Does ~/bin/subl have the executable flag set? –  Daniel Beck Oct 26 '11 at 16:42
add comment

5 Answers

up vote 12 down vote accepted

Make sure ~/bin is added to your $PATH

Put this is your .bash_profile

PATH=$PATH:~/bin
export PATH

and it should be available next time you open a shell

share|improve this answer
    
@Gavin - Another thing occurred to me. I'm not sure OSX uses .bash_profile by default. You could put the lines in your .bashrc instead. –  Nifle Oct 26 '11 at 16:50
    
OS X Terminal by default uses a login shell, so .bash_profile is correct here. –  slhck Oct 7 '12 at 8:41
add comment
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
share|improve this answer
add comment

if you are using RVM, do this:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/.rvm/bin/subl
share|improve this answer
add comment

I made a shell script like this into /usr/local/bin/ and I call it subl

#!/bin/bash
#
growlnotify -t "Sublime Text 2" -m "Sublime Text 2 is starting up."
/Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2

then I made the one for the superuser like this and I call it susubl

#!/bin/bash
#
growlnotify -t "Su > Sublime Text 2" -m "Sublime Text 2 is starting up as superuser."
sudo /Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2
share|improve this answer
add comment

for mac users: Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

and then:

open ~/.bash_profile

and add the folowwing lines:

PATH=$PATH:~/bin
export PATH
  • If you don't have a .bash_profile file in your user root you can make one in Sublime Text (or some other editor) and save it to your home folder with the above code. Then relaunch Terminal.
share|improve this answer
add comment

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.