Home Download Buy Blog Forum Support

Mac OS 10.8 - help installing command line

Mac OS 10.8 - help installing command line

Postby tuscanidream on Sun Jul 29, 2012 10:52 pm

Hello!

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

Setup

The first task is to make a symlink to subl. Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:

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


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

Code: Select all
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
tuscanidream
 
Posts: 7
Joined: Sun Jul 29, 2012 10:43 pm

Re: Mac OS 10.8 - help installing command line

Postby tuscanidream on Mon Jul 30, 2012 8:10 pm

Bump. 27 views so far and no ideas?
tuscanidream
 
Posts: 7
Joined: Sun Jul 29, 2012 10:43 pm

Re: Mac OS 10.8 - help installing command line

Postby elliott on Mon Jul 30, 2012 9:02 pm

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:
Code: Select all
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:

Code: Select all
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
elliott
 
Posts: 1
Joined: Mon Jul 30, 2012 8:55 pm

Re: Mac OS 10.8 - help installing command line

Postby phillip.koebbe on Mon Jul 30, 2012 9:59 pm

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:

Code: Select all
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Mac OS 10.8 - help installing command line

Postby tuscanidream on Mon Jul 30, 2012 11:35 pm

Added symlink (yes, to the correct directory)
Code: Select all
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

subl command not found

Added symlink (to the correct directory)
Code: Select all
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

subl command not found

echo $PATH
Code: Select all
/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
Code: Select all
PATH=$PATH:$HOME/.rvm/bin

edited ~/.bashrc to
Code: Select all
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.
Last edited by tuscanidream on Tue Jul 31, 2012 12:56 am, edited 1 time in total.
tuscanidream
 
Posts: 7
Joined: Sun Jul 29, 2012 10:43 pm

Re: Mac OS 10.8 - help installing command line

Postby C0D312 on Tue Jul 31, 2012 12:50 am

Code: Select all
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.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Mac OS 10.8 - help installing command line

Postby phillip.koebbe on Tue Jul 31, 2012 11:31 am

tuscanidream wrote:open ~/.bashrc
Code: Select all
PATH=$PATH:$HOME/.rvm/bin

edited ~/.bashrc to
Code: Select all
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.


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:

Code: Select all
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

Code: Select all
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.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Mac OS 10.8 - help installing command line

Postby gViro on Fri Oct 26, 2012 2:41 pm

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?

Code: Select all
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:
Code: Select all
subl --help,
I get:
Code: Select all
-bash: subl: command not found


Any help would be appreciated

thnx
gViro
 
Posts: 1
Joined: Fri Oct 26, 2012 2:00 pm

Re: Mac OS 10.8 - help installing command line

Postby gamatactic on Wed Oct 31, 2012 6:51 pm

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.
gamatactic
 
Posts: 1
Joined: Wed Oct 31, 2012 6:46 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 6 guests