VS Code Denied Permission unlink 'usr/local/bin/code'

I can add the "shell command install 'code' command". Testing it works, but if i close out of the VS Code or after a couple of hours of adding the command it doesn't work. Terminal says "zsh: command not found: code" and on VS when click on the "shell command install code command" has a "EACCES: permission denied, unlink 'usr/local/bin/code' " pop up. How should i go about this? I'm using a macbook 2020 if that matters

7 Answers

Uninstall the code command from PATH in VS Code and reinstall it. Open the command palette in VS Code using cmd + shift + p. Search "uninstall 'code'" and select the first option to uninstall. Once uninstalled, "install 'code'" for installing. That should fix it.

1

This happened to me on Macbook Pro M1 Chip. Basically follow this:

Simply uninstall the code command from PATH in vscode and reinstalled. i.e open the command pallete, search "uninstall 'code'" and select the first option to uninstall. Do same for installing too. That should fix it.

Found this solution on github

1

Try run:

sudo chown -R yourUsername /usr/local/bin 
3

From a sample size of me and three friends, this is a common problem on M1 MacBooks and Mac Minis. Running the command:

sudo chown -R yourUsername /usr/local/bin 

This resolved the VS issue for me and allowed me to install npm packages globally.

This command solves user just for copy paste.

sudo chown -R $USER /usr/local/bin

For macOS:

  1. Try uninstalling and reinstalling. (command + shift + p) >shell Command: Uninstall 'code' command from Path

  2. append the following to your ~/.bash_profile file (~/.zshrc in case you use zsh).

    code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;} 
1

I was getting same error to Install on Windows 11:

  • Just deleted folder C:\Users\my-username\AppData\Local\Programs\Microsoft VS Code\bin

  • Also removed VS Code from environment variables

Installed successfully!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like