Sublime Forum

Mac OS 10.8 - help installing command line

#1

Hello!

I have followed the directions here sublimetext.com/docs/2/osx_command_line.html and have not been able to successfully install the sublime command line tool.

I am using a fresh install of Mac OS 10.8 Mountain Lion. Here is what I tried:

Keils-iMac:~ keiljr$ ls -a
.			.gem			Documents
..			.gitconfig		Downloads
.CFUserTextEncoding	.rvm			Library
.DS_Store		.viminfo		Movies
.Trash			.zlogin			Music
.bash_history		.zshrc			Pictures
.bash_login		Archive			Projects
.bashrc			Desktop			Public
Keils-iMac:~ keiljr$ mkdir bin
Keils-iMac:~ keiljr$ cd bin
Keils-iMac:bin keiljr$ mkdir subl
Keils-iMac:bin keiljr$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Keils-iMac:bin keiljr$ cd subl
Keils-iMac:subl keiljr$ ls
subl
Keils-iMac:subl keiljr$ subl --help
-bash: subl: command not found

I’ve tried creating new terminal sessions, and even logging out and back in.

Thanks,

Keil

0 Likes

#2

Bump. 27 views so far and no ideas?

0 Likes

#3

Hello tuscanidream,

I see your link looks correct, but I’m wondering if the link is on your path? You can check this by running this command in your terminal:

echo $PATH

If the parent directory of your link isn’t in that output, then your link isn’t on your path and won’t work. You’ll need to add the parent directory to your path like so:

export PATH=~/bin:$PATH

To make the change permanent, add that command to the last line of your ~/.bash_profile (or ~/.bashrc if on linux).

Hope this helps,
-elliott

0 Likes

#4

Two things I noticed, one probably not important:

  1. You mkdir’d ~/bin, which is good. Then you mkdir’d ~/bin/subl, which I’m not sure why you did. Then you tried to create a symlink at ~/bin/subl, but that puts the actual symlink to the application in the subdir as ~/bin/subl/subl

  2. Is ~/bin (or in this case, ~/bin/subl) in your PATH? If not, you will have to use the full path to the symlink: ~/bin/subl/subl. If you are an admin user, you can get around this by putting the symlink in /usr/local/bin:

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
0 Likes

#5

Added symlink (yes, to the correct directory)

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

subl command not found

Added symlink (to the correct directory)

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

subl command not found

echo $PATH

/Users/keiljr/.rvm/gems/ruby-1.9.3-p194/bin:/Users/keiljr/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/keiljr/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/keiljr/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/ImageMagick/bin

Directory of symlink is not any of those paths

open ~/.bashrc

PATH=$PATH:$HOME/.rvm/bin

edited ~/.bashrc to

PATH=$PATH:$HOME/.rvm/bin:/usr/local/bin/subl

subl command not found

Am I doing something wrong?! I even logged out/in each time.

0 Likes

#6
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl

You seem to be really confused with how the path works, so just link subl to a directory already in the path.

0 Likes

#7

[quote=“tuscanidream”]open ~/.bashrc

PATH=$PATH:$HOME/.rvm/bin

edited ~/.bashrc to

PATH=$PATH:$HOME/.rvm/bin:/usr/local/bin/subl

subl command not found

Am I doing something wrong?! I even logged out/in each time.[/quote]

Adding something to PATH means you want the system to search in that location for things it can execute/use. You don’t add specific binaries or libraries to PATH, just directories. So if you want to add ~/bin to PATH, it would look like:

PATH=~/bin:$PATH

Also notice that we generally add things to the beginning of PATH, not the end. Not sure why your existing .bashrc had .rvm/bin at the end. That means that .rvm/bin will be the last place the system will look. It should be the other way around.

If you just symlink to /usr/local/bin, you don’t have to change anything. It is already in your PATH (or it should be). So just doing

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

should be sufficient. You shouldn’t need to log out either.

0 Likes

#8

Hi,

BUMP: I’m having the very same issue as the OP. Can anyone else confirm that the command below, which is from the ST2 docs, actually works?

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

I just started using ST2 and like it so far. I’d like to keep using it.

I don’t have a background in programming, am new to the Terminal (mere days), but willing to learn.

Now: The path to my “subl” file is: HD, Applications, Sublime Text 2, Contents, SharedSupport, bin, subl (a unix executable file, 414Kb).
I assume it was created when I ran the line command above, the one from the Sublime Text 2 docs, and that I have created a symlink.

But when I run: subl --help, I get: -bash: subl: command not found

Any help would be appreciated

thnx

0 Likes

#9

I found this page useful:
https://gist.github.com/1195304

It’s all about launching Sublime Text 2 from Terminal and addresses the strange directory issues listed in this post.

Hope this helps. If it doesn’t then I hope it wasn’t too inconvenient for you.

0 Likes