VS Code Insiders - Fixing Shell Recognition Issues
When you try to launch VS Code Insiders from the terminal with the code-insiders command, you may see an EACCES: permission denied error. This page explains the cause of the error and two ways to fix it, step by step.
Prerequisites
Section titled “Prerequisites”- You are using macOS
- VS Code Insiders is installed
- You can use a terminal such as Terminal or iTerm2
What the Problem Means: EACCES
Section titled “What the Problem Means: EACCES”EACCES stands for Error: Access, and it appears when access to a file or directory is denied.
When VS Code Insiders tries to register the code-insiders command as a symbolic link in /usr/local/bin, the directory is owned by root, so normal users do not have write permission and the installation fails.
EACCES: permission denied, unlink '/usr/local/bin/code-insiders'If this happens, running code-insiders . in the terminal may show zsh: command not found: code-insiders.
Fix 1: Change Ownership and Create the Symbolic Link Manually
Section titled “Fix 1: Change Ownership and Create the Symbolic Link Manually”Change the owner of /usr/local/bin to your own account and create the symbolic link manually.
Step 1: Check the current permissions
ls -ld /usr/local/binExpected output, if the owner is root:wheel, means you need to change it:
drwxr-xr-x 7 root wheel ... /usr/local/binStep 2: Change ownership to your account
sudo chown -R $(whoami):admin /usr/local/binYou will be asked for the administrator password.
Step 3: Remove the old link and create a new one
sudo rm -f /usr/local/bin/code-insiders
sudo ln -s "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders" /usr/local/bin/code-insidersStep 4: Verify it works
code-insiders --versionIf a version number appears, it worked.
⚠️ Important Changing ownership of
/usr/local/binmay affect other tools such as Homebrew. After the change, check that Homebrew still works normally.
Fix 2: Set an Alias as an Alternative Command
Section titled “Fix 2: Set an Alias as an Alternative Command”If writing to /usr/local/bin is difficult, you can use the shell’s alias feature to define an alternative command. This approach avoids permission changes and is simpler.
Step 1: Add an alias to ~/.zshrc
# Add to ~/.zshrc
alias code-insiders="open -n -a 'Visual Studio Code - Insiders' --args"You can add it directly in an editor, or append it with:
echo 'alias code-insiders="open -n -a '"'"'Visual Studio Code - Insiders'"'"' --args"' >> ~/.zshrcStep 2: Apply the settings
source ~/.zshrcStep 3: Verify it works
code-insiders .If the current directory opens in VS Code Insiders, the setup is successful.
💡 Tip An alias is only valid in the current shell session. Run
source ~/.zshrcor restart the terminal to make it available in new windows.
Comparing the Fixes
Section titled “Comparing the Fixes”| Item | Fix 1 (Change ownership) | Fix 2 (Alias) |
|---|---|---|
| Ease of use | Slightly more complex (sudo required) | Simple |
| Impact on other tools | May affect Homebrew and others | None |
Full code-insiders command | Available | Uses the open command path |
| Recommendation | Effective as a root fix | Good when you want a quick workaround |
Common Sticking Points
Section titled “Common Sticking Points”Installation path is different
If VS Code Insiders is not under /Applications, the path will differ. Check where it is installed.
find /Applications -name "code-insiders" -type f 2>/dev/nullYou forgot to restart the terminal If you do not restart the terminal after changing the settings, the change will not take effect. You can apply it immediately with:
exec $SHELL -lConfusing Insiders with the regular VS Code VS Code Insiders and the stable VS Code are different apps. Their app names, paths, and commands are different.
| Item | Stable | Insiders |
|---|---|---|
| App name | Visual Studio Code | Visual Studio Code - Insiders |
| Command | code | code-insiders |
Summary
Section titled “Summary”| Step | Command |
|---|---|
| Check permissions | ls -ld /usr/local/bin |
| Change ownership | sudo chown -R $(whoami):admin /usr/local/bin |
| Recreate the link | sudo ln -s "…/code-insiders" /usr/local/bin/code-insiders |
| Alternative with alias | alias code-insiders="open -n -a 'Visual Studio Code - Insiders' --args" |
Frequently Asked Questions
Section titled “Frequently Asked Questions”Q: Is it safe to use sudo?
A: sudo runs commands with administrator privileges. The commands here only change settings in your own environment, so they are fine if you understand what they do. Do not use sudo for commands you do not understand.
Q: Can I install code-insiders with Homebrew?
A: If you install it with Homebrew Cask using brew install --cask visual-studio-code-insiders, the shell command may be configured automatically. Be careful about conflicts with existing installations.
Q: What if I use Fish?
A: For Fish, set the alias in ~/.config/fish/config.fish. Add alias code-insiders "open -n -a 'Visual Studio Code - Insiders' --args" and run source ~/.config/fish/config.fish.