View Full Version : bash shell - where does it set PATH?
toddburch
May 9, 2008, 02:11 PM
I want to modify my default PATH for the default shell in Terminal. Can't figure out where the .profile or _login files are on Tiger.
Thanks!
robbieduncan
May 9, 2008, 02:15 PM
By default your user doesn't have a .profile. The system one gets used. But if you add a .profile to your ~ directory then it'll get used...
toddburch
May 9, 2008, 02:16 PM
Thanks Robbie. Where's the system one?
robbieduncan
May 9, 2008, 02:21 PM
The bash man page indicates that it should be at /etc/profile
And it is :) I'd really not recommend changing it though
toddburch
May 9, 2008, 02:32 PM
Not going to change that one - just getting my head around unix. Thanks!
Todd
toddburch
May 9, 2008, 02:34 PM
Ah - it's not called .profile, but profile. Got it!
yellow
May 9, 2008, 02:37 PM
Introduction to Darwin: http://www.osxfaq.com/Tutorials/LearningCenter/index.ws
An excellent UNIX FAQ: http://forums.macosxhints.com/showthread.php?t=40648
toddburch
May 9, 2008, 02:37 PM
Interesting. I installed JRUBY some time ago and its install modified /etc/profile to set an env. variable (JRUBY_HOME) and it modifies the path there to include its own bin path.
# System-wide .profile for sh(1)
JRUBY_HOME="/Users/toddburch/jruby-1.0.1"
PATH="/bin:/sbin:/usr/bin:/usr/sbin:$JRUBY_HOME/bin"
export PATH
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
Is that poor form?
yellow
May 9, 2008, 02:41 PM
Is that poor form?
Yes! Exceedingly poor form.
yellow$ more profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
Then in your ~/.bash_profile or ~/.profile:
PATH=$PATH:/usr/local/bin:/sw/bin:/sw/sbin:/Developer/Tools:/usr/X11R6/bin
export PATH
Where the stuff in blue is the modified PATH.
toddburch
May 9, 2008, 02:52 PM
OK, thanks yellow. I'll digest this, and a bit of the bash syntax (I have a book) and fix things up accordingly.
Is that "path_helper" something you put together?
yellow
May 9, 2008, 02:54 PM
Nope. Default part of Leopard.
http://www.hmug.org/man/8/path_helper.php
toddburch
May 9, 2008, 02:56 PM
I see - that's why my Tiger man page didn't turn up anything!
yellow
May 9, 2008, 02:59 PM
I was afraid you might have Tiger, but figured not when I looked at your profile and saw that you had a fat MP. My bad. :)
toddburch
May 9, 2008, 03:19 PM
I'll eventually upgrade to leopard when some key software I use resolves the issues it has with Leopard.
voodoojello
May 9, 2008, 09:46 PM
Under Leopard, simply modify /etc/paths
yellow
May 12, 2008, 07:20 AM
Under Leopard, simply modify /etc/paths
That's bad form. There's no reason that every bash shell opened on the box has to have the paths that the user needs.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.