Setting environment variables on OS X

后端 未结 30 3266
你的背包
你的背包 2020-11-21 05:15

What is the proper way to modify environment variables like PATH in OS X?

I\'ve looked on Google a little bit and found three different files to edit:

30条回答
  •  我寻月下人不归
    2020-11-21 05:51

    Up to and including OS X v10.7 (Lion) you can set them in:

    ~/.MacOSX/environment.plist
    

    See:

    • https://developer.apple.com/legacy/library/qa/qa1067/_index.html
    • https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

    For PATH in the Terminal, you should be able to set in .bash_profile or .profile (you'll probably have to create it though)

    For OS X v10.8 (Mountain Lion) and beyond you need to use launchd and launchctl.

提交回复
热议问题