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.
Written by Georg
Related protips
6 Responses
Install oh-my-zsh and enable sublime plugin.
it's similar to the mate
command that TextMate comes with, I use both quite a lot
I went extreme by running subl in a headless dev guest machine and then forwarded through X11.
Thank you ^^
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?
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