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


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:echo $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
  • Sounds more like you edit the file in a command line editor and forgot to save. .swp files are generated e.g. by vim while editing the file with the otherwise same name.
    – Daniel Beck
    Commented Apr 20, 2012 at 19:10
  • No 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.
    Commented Apr 20, 2012 at 23:40
  • '/usr/bin occurs before /usr/local/bin' (brew complains). Is that something I have to fix? Do you know?
    – r4.
    Commented Apr 20, 2012 at 23:42
  • You 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?
    – Daniel Beck
    Commented Apr 21, 2012 at 6:39

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .