We have just installed Sublime on our OS X! Is that all? No, we can also get the bleeding edge version from here: http://www.sublimetext.com/3dev. Bleeding edge versions are available for registered users only and are more susceptible to bugs.
Sublime Text ships with a CLI called subl
, but this CLI isn't added to our environment by default. We want to be able to use it straight from our terminal, so we need to add a symbolic link called subl to the subl
executable.
To see if it worked, type subl filename
in the terminal where filename
is the file you want to edit. Did it work? If not, then we need to add our folder that contains the new symlink to the environment. Run the following command:
The first line of the file should start with export PATH=
. It contains all the directories that will be looked into for executable binaries when we type a command in the terminal. Since we created a symlink to subl
inside the /usr/local/bin
directory, we will add it to the path by adding it to the directories:
Note
[…]
represents other directories that would be listed on the same line, separated by a colon.
Now, run the following code before continuing:
This will reload your .bash_profile
with the newly added directory.
Sublime CLI should work now; try one of the following commands:
That's it! We have Sublime Text with CLI running on our OS X!