I installed a program to try it out, and decided I didn't like it so I moved the app to the trash.

Today, in my shell, I noticed that there are a couple of PROGRAMNAME_BLAHBLAH environmental variables set. I'd like to remove those, too.

I don't even have a .bashrc or .bash_login, so I grepped every file I could think of (~/.* ~/Library/* /Library/* /etc/*). The only place these variables turned up was a file ~/.MacOSX/environment.plist, so I removed it from there (Xcode can edit binary plists), but new shells still have these variables set.

What other files does Mac OS X 10.7's terminal/bash run on startup? How might these variables get set?

Or is it something funny like "need to reboot after editing environment.plist"?

  • Can you list some specific examples of env variables you want to get rid of? Might make it easier to identify potential sources. And after changing environment.plist you need at least to logout/login again.
    – nohillside
    May 20, 2012 at 17:29
  • patrix: Log out, as in "Apple Menu -> Log Out" (as opposed to logging out of the shell)?
    – Ken
    May 21, 2012 at 4:22
  • Yes, as in "Apple Menu -> Log Out".
    – nohillside
    May 21, 2012 at 5:43
  • See also How to determine where an environment variable came from (which isn't Mac-specific) May 21, 2012 at 21:05
  • Is there anything we can add to daniel's answer to get your problem sorted out?
    – bmike
    Apr 24, 2013 at 15:52

2 Answers 2


~/.MacOSX/environment.plist is read at session start. If you want your change to it to be tested immediatly you have to restart your session.
A restart of the system is useless.
You can edit this environment initialisation file with:

plutil -convert xml1 environment.plist
vi environment.plist

I advise you to simply recover it to its version prior to your software installation.

Other hint, check all the files which were modified on the date of installation of your unwanted software. If you installed your software 15 days ago, you can perform this with:

find / -mtime -16 -mtime +14 -ls

This answer—which is not macOS-specific but probably much more likely to be relevant—solved the problem for me.

If you use zsh, this will give you a ton of output to search through:

zsh -xl

If bash is your thing

PS4='+$BASH_SOURCE> ' BASH_XTRACEFD=7 bash -xl 7>&2

See the original answer for more details.

  • You linked a question with 9 answers! Which one of these answers worked for you? Please post the relevant portions here rather than take the reader off site (even if another StackExchange community) to get the answer.
    – Allan
    Feb 28, 2023 at 22:07

You must log in to answer this question.

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