Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’

If you’re using macOS and trying to run the shortcut command:

code .

to open the current folder in VS Code, but you get a permission error like this:

EACCES: permission denied, unlink ‘/usr/local/bin/code’

then you’re not alone! This …


This content originally appeared on DEV Community and was authored by chuongmep

If you're using macOS and trying to run the shortcut command:

code .

to open the current folder in VS Code, but you get a permission error like this:

EACCES: permission denied, unlink '/usr/local/bin/code'

then you're not alone! This issue is quite common and happens because the /usr/local/bin/code file requires administrative privileges to modify or delete.

How to Fix It

To resolve this issue, follow these steps:

Step 1: Remove the Existing code Binary

Since the file is in /usr/local/bin/, you'll need admin permissions to remove it. Run the following command in your terminal:

sudo rm -f /usr/local/bin/code

Enter your password when prompted.

Step 2: Reinstall the code Command

Now, reopen VS Code, then follow these steps:

  1. Open the Command Palette (Cmd + Shift + P).
  2. Search for Shell Command: Install 'code' command in PATH.
  3. Click on it to reinstall the CLI command.

Step 3: Verify

To confirm it's working, try running:

code --version

If you see the version number of VS Code, then it's fixed! 🎉

Notes

  • This fix requires admin permissions to install the code command properly.
  • If you're using a non-admin account, you may need to ask your system administrator for help.

Now, you can happily use code . again without any issues! 🚀

Let me know in the comments if you run into any trouble! Happy coding! 😊


This content originally appeared on DEV Community and was authored by chuongmep


Print Share Comment Cite Upload Translate Updates
APA

chuongmep | Sciencx (2025-03-15T04:00:55+00:00) Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’. Retrieved from https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/

MLA
" » Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’." chuongmep | Sciencx - Saturday March 15, 2025, https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/
HARVARD
chuongmep | Sciencx Saturday March 15, 2025 » Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’., viewed ,<https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/>
VANCOUVER
chuongmep | Sciencx - » Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/
CHICAGO
" » Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’." chuongmep | Sciencx - Accessed . https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/
IEEE
" » Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’." chuongmep | Sciencx [Online]. Available: https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/. [Accessed: ]
rf:citation
» Fix EACCES: permission denied, unlink ‘/usr/local/bin/code’ | chuongmep | Sciencx | https://www.scien.cx/2025/03/15/fix-eacces-permission-denied-unlink-usr-local-bin-code/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.