I am trying to get sublime text to run from the command line using this tutorial http://www.sublimetext.com/docs/2/osx_command_line.html

It says to run this command:

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

But when I try to run that command I get an error "no such file or directory." Sublime text 2 is in my applications folder -- but it looks like there is no bin folder in my home directory. Do I need to create one? Is this something that should be there? Am I doing something wrong?


If you have administrator access on your machine, the easiest way is to put a symlink in the /usr/bin directory, as it already exists, and is already in your PATH, or the list of places the shell looks for commands to run. All you need to do is enter the following in a Terminal session:

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

If you've never run this before, you'll likely get a short warning that essentially says "Make sure you know what you're doing, and even then think about it twice before doing it. You can really screw stuff up bad with this." Type in your password at the prompt, and you should be all set.

The sudo command, which stands for "SuperUser DO", allows you to run commands with elevated privileges, in this case allowing you to create a file in the /usr/bin directory, which normally doesn't allow the creation of new files in it. This is exactly the same as entering your password when installing a new program.

Once you've run the above command, quit your Terminal session completely (using Q, not just shutting the window) and restart it, and you should now be able to run subl filename.txt at the command line and open any file you want in Sublime.

Good luck!


Note: Somewhere along the line they took the " 2" off the end of the app name... When they did that all of the docs that show how to get subl to work became obsolete.

The old answers still work if you remove the " 2" from the end of Sublime Text 2


Only try ln -s "/Applications/Sublime Text\ 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl if you have version 2

remember the \

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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