I’ve struggled with a long-standing bug that causes the Sublime Text 2 command-line launcher to fail sporadically. In order to use the command-line launcher, the documentation directs you to create a symbolic link to the command-line utility stored in the application bundle:
Then, assuming you have a bin directory in your home directory, and it’s in your path, you can open files in ST2 from the command line:
The problem is that the
subl command is buggy. If ST2 isn’t running, or if it is running and
there’s an open window, everything works well. The file is opened and it appears in a new tab.
But, if ST2 is running and doesn’t have any open windows, the
subl command will silently fail.
ST2 will open a blank window with no tabs and no content.
There’s a simple hack that gives you 90% of what you want from the
subl command. You can create
an alternate command that works 100% of the time to open files. Create a one-line shell script
that looks like this:
Save it wherever you like and use that script to open files. This isn’t a replacement for the
subl command. That command supports command-line arguments like ‘-w’ to allow ST2 to be used
as an editor for Git and other tools. This script is purely for opening files from the
Categories: Mac ComputerSublime Text, Tip, macOS