'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
Solution 1:[1]
Uninstall the code command from PATH in VS and reinstalled.
Open the command palette in VS cmd + shift + p
search "uninstall 'code'"
and select the first option to uninstall.
Do the same for installing too.
That should fix it
Solution 2:[2]
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.
Solution 3:[3]
Try run:
sudo chown -R yourUsername /usr/local/bin
Solution 4:[4]
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.
Solution 5:[5]
This command solves user just for copy paste.
sudo chown -R $USER /usr/local/bin
Solution 6:[6]
For macOS:
Try uninstalling and reinstalling. (command + shift + p) >shell Command: Uninstall 'code' command from Path
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 $* ;}
Solution 7:[7]
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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sabrina Tolmer |
Solution 2 | Ash Singh |
Solution 3 | GChaves |
Solution 4 | benson23 |
Solution 5 | uruapanmexicansong |
Solution 6 | Manthan Shah |
Solution 7 | Ali Adravi |