This assumes you installed sublime text 2. if not - do that here - http://www.sublimetext.com/2
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications
like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
The reason why sublime is not shipped default is that it is too long to type. the reason for subl being lame is that it's not a word. textmate is great because I type mate to get along editing whatever directory or file I want. slim is the new mate and gives me those good feelings the way it is typed with few finger movements and has meaning.
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/slim
This will simply create a symlink called sublime
(remember, we like names that don't suck to type 500 times a day) between the subl
binary stashed in the Sublime application package, and a folder where your system usually looks for binaries to execute (launch). Think of it as a wormhole of awesome.
Now let's do a check to see if everything will run smoothly. Enter this:
open ~/.bash_profile
.
You should see at the top of the file a line that starts with:
export PATH=
This contains all the directories that will be looked into for executable binaries when you type a command in Terminal. Since we create a symlink to subl
called sublime
in the /usr/local/bin
directory let's check if this directory is listed on that same line.
If it is, perfect. Let's keep going. If not, simply add it like this and save the file:
export PATH=/usr/local/bin:(...)
Note: The "(...)" in this example represents other folders that would be listed on the same line and separated by a colon.
If you had to add /usr/local/bin
to your PATH, run the following command before continuing:
source ~/.bash_profile
This will reload your .bash_profile
with the newly added directory.
Open a Terminal window and run:
slim filename
(replace "filename" by an actual file name)
or
slim foldername
(replace "foldername" by an actual folder name)
or even
slim .
(to open the entire current directory)
Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your .bash_profile
which you would have needed with the official instructions given by the Sublime team.
Have fun, Sublime is a great editor showing a lot of promise.