Open Sublime Text 2 from the Mac OS X Command Line

17th November 2012

Warning: This post is over a year old. I don't always update old posts with new information, so some of this information may be out of date.

How to open Sublime Text from the command line.

Paste the following code into the Mac OS X Terminal, assuming that you've installed Sublime Text 2 into the /Applications folder.

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

Now you can type sublime <filename> open a file or directory in Sublime Text, or sublime . to open the current directory.

You can also type sublime --help to see a list of the available commands.

Questions? Comments? I’m @opdavies on Twitter.

Tags: mac-os-x, sublime-text, terminal

About the Author

Picture of Oliver

Oliver Davies is a full-stack Web Developer and System Administrator based in the UK. He is a Senior Developer at Microserve and a part-time freelancer specialising in Drupal, Symfony and Laravel development and Linux systems administration.