How to setup enviromental variables (MacOS)?
On macOS, a distinction must be made between permanent environment variables, which continue to exist even after a system reboot, and temporary variables, for which this does not apply.
1. Can be set quite easily and quickly via the terminal:
2. Open terminal: e.g. search for it via Spotlight and open it.
set the variable with the command "export <variable_name>=<variable_value>".
Replace <variable_name> and <variable_value> with their respective values.
3. Use "echo $<variable_name> " to check if the variable was added.
1. Open Terminal: e.g. search for it via Spotlight search and open it
2. Then enter the command "sudo nano /etc/profile" and confirm. Afterwards an admin password must be entered. This is not displayed, which is normal.
3. In the now open editor add the line "export <variable_name>=<variable_value>" and for each additional variable add another line according to the above scheme.
Save with control + S and exit with control + X.
Replace <variable_name> and <variable_value> with the respective values.
Restart the computer or log in again, so that the variable is taken over.