You can open a file in Sublime Text from the Mac command line. Here is how you do it with versions 2 and 3 of this popular text editor.
Sublime Text 2
Create a symbolic link to the subl binary with this command:
Sublime Text 3
The install path is different in Sublime Text 3. Create the symbolic link like this:
Confirm that it Works
Confirm that it works by accessing the help file with the
If you receive an error, make sure that
/usr/local/bin is on your PATH.
Use it on the Command Line
Use the filename as the argument to subl. If there are spaces in the filename path, make sure that you surround the entire path with double quotes or escape the spaces.
Here is an example with the file ‘test.txt’: