Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add ~/bin to my path?

I've been having trouble modifying my path to add Sublime Text 2. I've added a ~/bin directory and run this command:

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

The subl link appears in ~/bin. But I need to add the ~/bin directory to my path. I'm fairly new at this, and I don't know where my path is. I've looked around, and found that the likely files are either .profile, .bash_profile or .bashrc

I don't have a .bash_profile. To .profile and .bashrc I added

PATH=$PATH:~/bin/subl export PATH 

Is that the right thing to add? And if so, where should I add it?

When I echo $PATH, I get:

/Users/<username>/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/bin:/Users/<username>/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/<username>/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/<username>/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin 

When I type subl, I get:

-bash: subl: command not found 

Thanks!

p.s. I had previously installed Macports, which modified my .profile file. Not sure if this has anything to do with it - I now don't know what the default .profile looks like.

like image 348
Graeme Avatar asked May 26 '12 15:05

Graeme


People also ask

How do I permanently add local bin to PATH?

To make the change permanent, enter the command PATH=$PATH:/opt/bin into your home directory's .


1 Answers

I was just as new to this as you, which means I wasn't even sure how to read half the stuff related to modifying PATH. Eventually though I came upon a way to do it that doesn't require you to put subl into the .rvm/bin (since that is for something else) but in its appropriate directory, which is ~/bin.

Go to your terminal and type:

open -a Finder /usr/bin 

This will open your Finder to the /usr/bin directory. Once you're there open a new Finder, go to Applications, right click on the Sublime Text icon and go to Show Package Contents, then to Contents, SharedSupport, bin. Copy the subl file and paste it into the other Finder showing /usr/bin

That's it! You should be set to use the command:

subl . (or subl file.name) 
like image 105
dgamboa Avatar answered Sep 25 '22 15:09

dgamboa