Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
[ -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
share|improve this question
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 Apr 20 '12 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. Apr 20 '12 at 23:40
'/usr/bin occurs before /usr/local/bin' (brew complains). Is that something I have to fix? Do you know? – r4. Apr 20 '12 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 Apr 21 '12 at 6:39
Thanks Daniel ! :) – r4. Apr 23 '12 at 9:43
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.