|
|
#1 |
|
Prospect
Join Date: Apr 2012
Posts: 3
|
changing $PATH and finding .profile?
Hi all,
I am pretty new to unix - so sorry if this is trivial....On Mac OS X 10.6 running terminal: I need to add a directory to my $PATH, tried PATH=$PATH\:/usr/local/newdir; export PATH For whatever reason when I do this now it works only for this particular shell, and the PATH gets reverted to what it was before. After some reading on the web I understood that I may need to change it in .bash_profile or .profile files, but I can't find them anywhere (looking through hidden files with ls -a).... How do I permanently change $PATH and where is it stored? Thank you in advance Yu
|
|
|
|
|
|
#2 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,938
|
See this Unix FAQ
__________________
hayne.net/macosx.html |
|
|
|
|
|
#3 |
|
Prospect
Join Date: Apr 2012
Posts: 3
|
Hi Hayne
I looked at it before posting, the export works for the specific shell, for whatever reason the PATH keeps reverting for every new shell I open. The shell is bash... Yu
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,549
|
Look at this specific section of the Unix FAQ: How do I set up my shell execution PATH?, specifically the words 8 through 12 under both the sections that are titled, "Setting PATH in the xxxx Shell".
Trevor
__________________
How to ask questions the smart way |
|
|
|
|
|
#5 |
|
Prospect
Join Date: Apr 2012
Posts: 3
|
Hi Trevor - thanks for the response, apparently I am missing something:
this is what that sections says: "Setting PATH in the bash shell To set up your PATH in bash, you edit the file ~/.profile (using any text editor that can save in plain text - e.g. 'pico') and add a line like the following...." I dont have a .profile or .bash_profile file anywhere...not in ~ directory and not in any system directory I tried to look in. I looked through the hidden files as well. It also says to use export: "export PATH="/bin:/sbin:/usr/bin:/usr/sbin" The above would set the following folders/directories to be in your PATH...." This seems to work only for the specific shell instance I am running. If I open a new shell, in that shell the PATH variable reverts to what it was before..... I think I dont have Fink installed so the next paragraph is not relevant. After that it goes to tcsh shell. Did I miss anything in that section? Yu
|
|
|
|
|
|
#6 | |||||||||||||||||||||||
|
Moderator
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,549
|
If you don't have a ~/.profile file, then you'll need to create one. Setting the PATH with a command, but not actually saving it to a configuration file such as ~/.profile, will just change the PATH for the shell that you currently have running, not into the future. Trevor
__________________
How to ask questions the smart way |
|||||||||||||||||||||||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|