How to add environment variables in Mac OS X

Adding here for reference (tried this in Mac OS X Mojave):


# To set an environment variable, enter the following command:
launchctl setenv variable "value"

# To find out if an environment variable is set, use the following command:
launchctl getenv variable

# To clear an environment variable, use the following command:
launchctl unsetenv variable

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.