To set PATH on OS X when export PATH= don't work
5,232
My quick fix. If I have. An empty .bashrc (when I put something there it breaks) , the line PATH="/usr/local/bin:$PATH:/usr/local/sbin" in both .profile and .bash_profile. As Daniel for pointing out terminal does not load .profile if .bash_profile exist.
Related videos on Youtube
Author by
r4.
Updated on September 18, 2022Comments
-
r4. over 1 year
I can't do 'export PATH=' When I try that only .swp files is created (.bash_profile.swp and .bashrc.swp). I'm on OS X 10.6.
$ echo $PATH
/Users/masterpriindustriellledning/perl5/perlbrew/bin:/Users/masterpriindustriellledning/perl5/perlbrew/perls/perl-5.14.2/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/X11/bin:/Users/masterpriindustriellledning/.rvm/bin
My .bash_profile , (When installed latest perl this corrected previous errors that .bashrc did not load. It had not done so since I created a .emacs I think)
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting source /Users/masterpriindustriellledning/perl5/perlbrew/etc/bashrc # Added by install_latest_perl_osx.pl [ -r /Users/masterpriindustriellledning/.bashrc ] && source /Users/masterpriindustriellledning/.bashrc
My .profile
export PATH="/usr/local/bin:$PATH:/usr/local/sbin"
'brew doctor' gives some warnings. Never used brew since my brew does not work.
$ brew doctor
1. Warning: Unbrewed dylibs were found in /usr/local/lib. 2. Warning: Unbrewed static libraries were found in /usr/local/lib. 3. Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. ... Consider amending your PATH so that /usr/local/bin is ahead of /usr/bin in your PATH. 4. Warning: Your Xcode is configured with an invalid path. ... *(brews suggested fix is not working for me)
My tries so far is.
$ grep export .??* , i.e. the things I tried to export to $PATH.
.bash_history:export GRAILS_HOME=/usr/share/java/grails .bash_history:export PATH=$GRAILS_HOME/bin:$PATH .profile:export PATH="/usr/local/bin:$PATH:/usr/local/sbin"
$ grep PATH .??*
.bash_history:which PATH .bash_history:PATH .bash_history:$PATH .bash_history:echo $PATH .bash_history:PATH=$GRAILS_HOME/bin:$PATH .bash_history:export PATH=$GRAILS_HOME/bin:$PATH .bash_history:echo $PATH .bash_history:echo $PATH .bash_history:whereis $PATH .bash_history:which $PATH .bashrc:PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting Binary file .bashrc.swp matches .profile:export PATH="/usr/local/bin:$PATH:/usr/local/sbin" .zshrc:PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
-
r4. about 12 yearsNo no no. There was 2 swap files generated at the exact same time. That was when I (a little tired) thought that 'export PATH=' was a command. Copy paste without proper reading.
-
r4. about 12 years'/usr/bin occurs before /usr/local/bin' (brew complains). Is that something I have to fix? Do you know?
-
HikeMike about 12 yearsYou cannot replace system binaries with those from homebrew then because the originals are found first. Note that .profile isn't usually loaded when there's e.g. Bashrc or bash_profile, is that the problem?
-