Since I upgraded to OS X Yosemite I do have massive problems with environment variables that I really, really NEED for development of some projects.

The Problems is:

Every time I install some kind of update from the app store and my macbook restarts in order to install it, it will delete all, but really all of my environment variables which then costs me nearly an hour to set it up again.

I've tried so many different solutions until now (I don't want to start listing them up here, I really searched the www for some hours...) and nothing has worked as permanent/persistent environment variable.

What I need to do:

  • System wide environment variables that are NEVER reset without my action. They have to be persistent/permanent!
  • Environment variables have to be readable by shell as well as GUI applications

I feel helpless and somehow stupid. It's so easy on all linux distros I know and also in the Windows world. Why does it seem to be so hard for OS X?

  • 2
    Please add some examples of variables you lost updating your current system (and how you set them in Yosemite compared to Mavericks).
    – klanomath
    Feb 20 '15 at 10:08
  • 1
    how are you setting them up now? isn't this easily doable in ~/.profile ? Feb 21 '15 at 1:08
  • @venicejeff: not for gui applications.
    – 0942v8653
    Feb 21 '15 at 3:15
  • 1
    You can find one way to do it here: stackoverflow.com/questions/25385934/…
    – swpalmer
    Mar 4 '15 at 1:38
  • I still haven't found a proper way. Sometimes my env variables are just gone after a system update (not OS update, just normal updates). I have setup a wiki page and script which I let run whenever they're reset
    – byemute
    Oct 22 '15 at 8:34

have you tried adding them to your .bash_profile?

assuming you know how to use the vi editor:

  1. open terminal
  2. enter vi ~/.bash_profile
  3. add one line like the following for each environment variable you need to persist
    • export PS1='\[\033[34m\]\w\[\e[m\] 🐘💨 '
  4. Save the file.
  5. Restart your computer.

The only other thing would be to consider backing up your .bash_profile in case somehow you lose or corrupt it.

You must log in to answer this question.

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