OS X 10.10 Yosemite and environment variables

Submitted by Jochus on Tue, 14/04/2015 - 18:59 | Posted in: Mac


In previous releases of OS X (Mavericks, Mountain Lion, Lion, ...), environment variables are configured in the /etc/launchd.conf file.

As of OS X Yosemite, this is no longer working. To configure environment variables, you can do the following

$ nano ~/Library/LaunchAgents/my.startup.plist

my.startup.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist">http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist</a> version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>launchctl setenv $VARIABLE_NAME $VARIABLE_VALUE</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.