Opening Sublime Text 3 in Terminal problem and Solution!

Ok. I just want to document this for myself and don’t think anyone else will use this. I was using Sublime Text 2 and having a grand ole time but then I decided to upgrade to Sublime Text 3. It is in beta but I figured it would be a smart thing to do.

The problem is I had a great workflow with Sublime Text 2 and as soon as I upgraded to ST3, all hell broke loose. My workflow grinded to a halt and I found myself wasting time trying to do something as simple as open Sublime from the terminal. It was so easy in Sublime Text 2. Now it wasn’t working.

I searched online and pulled my hair out but here is the solution.

The problem was I created a symlink to open ST2 from the terminal and when I upgraded to ST3, it was still using the symlink from ST3.

I had a bunch of alias’ in my .bash-profile that were now all breaking.

I was getting this error: -bash: /usr/local/bin/sublime: No such file or directory

So here’s the solution:

I went to this site and found what I thought was the solution:

But when I entered the symlink provided I got this error:
ln -s “/Applications/Sublime” /usr/local/bin/sublimeln: /usr/local/bin/sublime: File exists

Following the comments advice I found where my current symlink was pointing:
$ ls -l /usr/local/bin/sublime

which gave me this output:
lrwxr-xr-x 1 root admin 64 May 23 2013 /usr/local/bin/sublime -> /Applications/Sublime Text

This is where the problem was. My symlink was still pointing to Sublime Text 2 even though I uninstalled it.

So now my question was ‘how the heck to you remove a symlink’?

Easy type this in the terminal:

$ rm /usr/local/bin/sublime

I then got this error:
rm: /usr/local/bin/sublime: Permission denied

The reason? Whenever this happens just preface your command in the terminal with ‘sudo’ like this:
$ sudo rm /usr/local/bin/sublime

type your password word and your old symlink will be removed.

Now add the new symlink:

sudo ln -s “/Applications/Sublime” /usr/local/bin/sublime

Type your password if needed.

And Bam! You should now be able to open Sublime Text 3 from the terminal using ‘Sublime’ + the file you want to open.

note: I like typing ‘Sublime’ better than ‘subl’. Most stuff online shows you how to open with ‘subl’. I’m just more used to typing ‘Sublime’.

Hope that post helps you save time.

2 Replies to “Opening Sublime Text 3 in Terminal problem and Solution!”

Leave a Reply

Your email address will not be published. Required fields are marked *