I want to set a permanent environment variable, I have used the .profile, .zshrc, .bash_profile, however, none have worked, after doing the command source .profile it works while I have the terminal open, but then when I close the terminal and reopen a new saves these variables.
This is how I save the variables in the files
export M2_HOME=/Applications/apache-maven-3.3.3
export PATH=$PATH:$M2_HOME/bin/