Subl command not working - command not found

HectorOfTroy407 picture HectorOfTroy407 · Aug 6, 2014 · Viewed 53.6k times · Source

I'm having difficulty getting this set up. I fixed my .bash_profile, and created the symlink using the following command from the Sublime website:

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

Yet, when I input that command I get:

ln: /Users/my_username/bin/subl: No such file or directory

It appears my terminal is looking at the wrong place for the file? Why is it trying to point to a bin folder on my home directory?

Answer

sarbbottam picture sarbbottam · Aug 6, 2014

Create the symlink in /usr/local/bin instead of ~/bin and make sure that /usr/local/bin in in PATH.

$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/.
$ echo $PATH

If you don't find /usr/local/bin/, then add the following lines to your .bashrc or .zshrc:

PATH=$PATH:/usr/local/bin/; export PATH