1 | initial version |
To set up environment variables on your M1 MacBook, follow these steps:
Open Terminal on your Mac.
Type the following command to create a new file:
touch ~/.zshrc
Open the file in a text editor using the following command:
open ~/.zshrc
Add the environment variable(s) to the file in the following format:
export VARIABLENAME=variablevalue
For example:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home
Save the file and exit the text editor.
To apply the changes, run the following command in Terminal:
source ~/.zshrc
Now, to resolve the ZSH permission denied error, follow these steps:
Open Terminal on your Mac.
Type the following command:
sudo chmod u+x /usr/local/bin
Press Enter and enter your administrator password when prompted.
This command gives user execute permission on the /usr/local/bin directory where many of the user-installed binaries are located.
With these steps, you should be able to successfully set up environment variables on your M1 MacBook and resolve the ZSH permission denied error.