How do I undo "export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile"

You certainly don't need to reinstall - just remove the offending last line of the file and restart terminal to see the effects.

If you don't know how to edit the file from terminal, you can open the file in your system's default plain text editor:

/usr/bin/open ~/.bash_profile

Just delete the last line and save the file. (The >> tacks the output of the echo on to the end of the file) At that point, quit terminal, reopen terminal and test brew doctor again.

Apple has an overview of editors you can use in terminal if you want to edit files more regularly.

  • http://support.apple.com/kb/HT4850

For beginners, the nano editor is perhaps the easiest since it has visible help for basic commands. You can get some more guided help on nano from the web by opening the URL in your preferred browser (or having terminal do that for you open http://www.nano-editor.org/).


You say that you ran the following command:

echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

This would have appended the line export PATH='/usr/local/bin:$PATH' to your .bash_profile. However, you then ran the line without the echo.

This would have broken your path, but only for the session that you're in. The ">> ~/.bash_profile" would have had no effect since there is no output of that command.

Simply close the Terminal window and open a new one. Running export just changed the PATH for your current shell. A new shell will source the relevant files again for you, setting the path correctly, providing the line that you added to your profile with the echo is removed (see bmike's answer).


You didn't see any effect because you should have restarted terminal or alternatively

source ~/.bash_profile

To make the changes into effect. Addings paths into the .bash_profile file is sort of like adding shortcuts into the desktop, except these are shortcuts for the terminal, i.e. you tell it where stuff is.