Ask Your Question
0

How can I set up Environment variables on my M1 MacBook and resolve the ZSH permission denied error?

asked 2022-08-15 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-08 07:00:00 +0000

scrum gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-08-15 11:00:00 +0000

Seen: 10 times

Last updated: Nov 08 '21