How To Setup A Command To Open Sublime Text From The Terminal On A Mac

April - 2022

I setup my Mac (running macOS 12.x) to launch Sublime Text from the command line by making a symbolic link like this:

ln -s "/Applications/Sublime" "/usr/local/bin/st"

That lets me type st to open Sublime Text. I can also do st file.txt or st file1.txt file2.txt to open files.

The approach from the official documentation is to update the PATH that gets used to look for command line tools to point to the /Applications/Sublime directory. That sets up to use the binary named subl.

The reason I use the symbolic links is so I can use the command st instead of subl since it's shorter and easier to type.