How to Set Environment Variables in Mac

Environment variables are the piece of information which actually contains the information for the users logged in to the Operating system. We use them to provide the necessary data used by variables in some of our scripts.
In this tutorial we will guide you how to set environment variables in mac.



Step 1 – Opening Utilities Folder
First of all, click on go and open up the Utilities folder.
Utilities Option

Step 2 – Terminal
In the Utilities window, open up the terminal.
Opening system Terminal

Step 3 – Writing Command
With the terminal window opened up, type the command,
mkdir .MacOSX and hit return. This will create a directory.
Command

Step 4 – Creating File
In mac, to set environment variables, we have to type the following command:
echo “”> .MacOSX/environment.plist and hit return
This will create a file called program list. We have to ensure about the file that it is hard coded, so that no system data gets damaged.
Creating Program List

Step 5 – Opening the File
Now open up the file with the following command.
open .MacOSX/environment.plist
Opening Program List

Step 6 – Editor Window
With the editor window opened up, over here you can easily set the environment variables of any program.
And that’s it.
Setting Environment Variable

And that is how mac sets environment variable.