Sublime Forum

ST3 - 'subl' Error: Unable to launch Sublime Text

#1

I updated to ST3 today on Mac OSX and tried to symlink the ‘subl’ (ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl) everything looks good except that when I try to use subl . it says Unable to launch Sublime Text.

But I can see the help dailog using subl --help.

Any help appreciated.

Thanks.

0 Likes

#2

BUMP.
This is happening to me as well. Not sure if it is a Sublime Text issue, or an OS X issue.

0 Likes

#3

On recent versions of OS X (Mavericks & Yosemite were what I tested), the subl command communicates with a running instance of Sublime Text 3.

Start Sublime Text 3 in the usual way (from Finder/Spotlight/whatever), then try using the subl command, and it should work.

Here’s the script I use:

#!/usr/bin/env bash
sublimeDir="/Applications/Sublime Text.app"
sublimeBin="/Contents/SharedSupport/bin/subl"

# try launch, if fails, start sublime text and try again
if ! "${sublimeDir}/${sublimeBin}" $* 2>/dev/null; then
	if ! open -j "${sublimeDir}"; then
		echo "Are you in a screen or tmux session?"
		exit $?
	fi
	sleep 1
	"${sublimeDir}/${sublimeBin}" $*
fi
0 Likes