Opening Sublime Text from the command line

I’m using Sublime Text 3 beta as my text editor. It’s fast and lightweight, but at the same time it’s very powerful. Here’s how you can open Sublime Text from the command line.

Here’s how you can open Sublime Text from the command line:

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

(if you’re using Sublime Text 2, just replace the path in the first argument)

If you would rather like to use another name for the command that opens Sublime Text, just change the last part (subl) of this command to whatever you want.

For this to work you must have /usr/local/bin in your $PATH environment variable. To check if it’s already there, type this into your command line:

echo $PATH | grep -q "/usr/local/bin"

If nothing is returned, you must add /usr/local/bin to $PATH. I’m not going to cover how you do this, because there are probably hundreds of other sites that does.

When everything is set up, you can type any of the following in your terminal:

subl <filename> # Opens a file
subl <foldername> # Opens a folder
subl . # Opens the current folder