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 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?

share|improve this question
add comment

1 Answer

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!

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.