Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To set up environment variables on your M1 MacBook, follow these steps:

  1. Open Terminal on your Mac.

  2. Type the following command to create a new file:

    touch ~/.zshrc

  3. Open the file in a text editor using the following command:

    open ~/.zshrc

  4. 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

  5. Save the file and exit the text editor.

  6. To apply the changes, run the following command in Terminal:

    source ~/.zshrc

Now, to resolve the ZSH permission denied error, follow these steps:

  1. Open Terminal on your Mac.

  2. Type the following command:

    sudo chmod u+x /usr/local/bin

  3. 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.