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

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

The instructions make perfect sense: Run

ln -s "/Applications/Sublime Text" ~/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
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
up vote 12 down vote accepted

Make sure ~/bin is added to your $PATH

Put this is your .bash_profile

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
sudo ln -s "/Applications/Sublime Text" /usr/local/bin/subl
share|improve this answer

if you are using RVM, do this:

ln -s "/Applications/Sublime Text" ~/.rvm/bin/subl
share|improve this answer

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

growlnotify -t "Sublime Text 2" -m "Sublime Text 2 is starting up."
/Applications/Sublime\ Text\\ Text\ 2

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

growlnotify -t "Su > Sublime Text 2" -m "Sublime Text 2 is starting up as superuser."
sudo /Applications/Sublime\ Text\\ Text\ 2
share|improve this answer

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" ~/bin/subl

and then:

open ~/.bash_profile

and add the folowwing lines:

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

You must log in to answer this question.

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