DEV Community

Raghwendra Sonu
Raghwendra Sonu

Posted on

How to update environment variable on Mac

Goto terminal
Run : VIM ~/.BASH_PROFILE
Enter I
TO INSERT NEW ENVIRONEMNT PATH
export M2_HOME=/Users/1138872/Documents/Automation/Software/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin:$JAVA_HOME/bin:$GRAILS_HOME/bin

You can add multiple paths in PATH variable by using : also remember to use /bin in the end of path variable
Once edited this file, tap esc button
Enter :wq to edit this file and quit
To execute this file close all terminal and rerun again else Type source .bash_profile to execute the .bash_profile file.

To verify successful installation enter: echo $PATH. It should display your newly added path. Also, You can type echo $M2_HOME

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more