How to set ENV variables on our local terminal
Setting environment variables on a local terminal depends on the operating system you are using. Here are instructions for setting environment variables on different operating systems:
Windows:
- Open the “Start” menu and search for “Environment Variables”.
- Click on “Edit the system environment variables” to open the System Properties window.
- In the System Properties window, click on the “Environment Variables” button.
- In the “User variables” or “System variables” section, click “New” to add a new variable.
- Enter the name and value for the environment variable, and click “OK” to save.
macOS/Linux:
- Open a terminal.
2. To set a temporary environment variable for the current session, use the following command:
export VARIABLE_NAME=value
3. To set a permanent environment variable for all terminal sessions, open the shell configuration file (e.g., ~/.bashrc
, ~/.bash_profile
, ~/.zshrc
, etc.) using a text editor.
4. Add the following line at the end of the file:
export VARIABLE_NAME=value
5. Save the file and restart the terminal or run source ~/.bashrc
(or the corresponding file for your shell) for the changes to take effect.
Remember to replace VARIABLE_NAME
with the name you want for the environment variable and value
with the desired value.