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.
Step 2 – Terminal
In the Utilities window, open up the terminal.
Step 3 – Writing Command
With the terminal window opened up, type the command,
mkdir .MacOSX and hit return. This will create a directory.
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.
Step 5 – Opening the File
Now open up the file with the following command.
open .MacOSX/environment.plist
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.
And that is how mac sets environment variable.