Setting Up Environment Variables on MacOS Yosemite Using Launch Agent
In previous releases of macOS (Mavericks, Mountain Lion, Lion, …), configuring environment variables required editing the /etc/launchd.conf
file. However, starting from macOS Yosemite, this method is no longer effective. To successfully configure environment variables on Yosemite and later versions, follow these steps:
-
Create a Launch Agent Property List (plist) File: Create a plist file named
my.startup.plist
in the~/Library/LaunchAgents/
directory. This directory is specific to user-based launch agent configurations. -
Define the Plist Structure: The content of the
my.startup.plist
file should adhere to the XML-based property list format. This format is used to specify various attributes that dictate the behavior of launch agents.