pkro8g
Last Updated: February 25, 2016
·
4.712K
· calamari
6b4b7f11163b1e87571995ce8c3f0bce

Open Sublime Text 2 from the console (MacOS X)

Sublime Text 2 is an awesome text editor, which gains a bigger userbase every hour. And I think it is more popular than Textmate nowadays.

One hidden feature of Sublime is, that it comes with a command line program. It's called subl (I guess it should have the same length then the famous mate) and you will find it in the SharedSupport/bin directory of the app itself. There:

/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

The only thing you have to do, is add it to the PATH variable, and reload the terminal. I like to just add it in the ~/.bash_profile, where I just add the line:

export PATH=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/:$PATH

And after reloading that file (or simple opening a new terminal):

source ~/.bash_profile

you can do simple things like:

$ subl .

or

$ subl ~/my_project

Have fun with that.

Say Thanks
Respond

6 Responses
Add your response

1458
Photo on 08.01.2013 at 04.15

Install oh-my-zsh and enable sublime plugin.

over 1 year ago ·
1482
D26d4c5f8e66a59377644f7f51ab54d3

it's similar to the mate command that TextMate comes with, I use both quite a lot

over 1 year ago ·
1826
A1fd6c233c932cca8da899735e314640

I went extreme by running subl in a headless dev guest machine and then forwarded through X11.

over 1 year ago ·
4896

Thank you ^^

over 1 year ago ·
5566

Say I wanted to have this be available without having to run source ~/.bash_profile every time I open a new terminal instance (as I currently do), whereabouts would I start with that?

over 1 year ago ·
8358
6b4b7f11163b1e87571995ce8c3f0bce

Of course, you could also symlink it into the /usr/local/bin directory, so you would not need to put anything into the .bash_profile

over 1 year ago ·