vscode: Cannot add `code` to PATH, permission denied
Issue Type: Bug
Opening the command palette and trying to add the code
command to PATH
results in the following error:
EACCES: permission denied, unlink '/usr/local/bin/code'

This is from a fresh install.
VS Code version: Code 1.58.2 (Universal) (c3f126316369cd610563c75b1b1725e0679adfb3, 2021-07-14T22:09:06.581Z) OS version: Darwin arm64 20.4.0 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Apple M1 (8 x 24) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: disabled_off_ok video_decode: enabled webgl: enabled webgl2: enabled |
Load (avg) | 4, 4, 3 |
Memory (System) | 16.00GB (0.41GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
vspre833:30321513
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscus158:30321503
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlang:30333561
binariesv615:30325510
vsccppwt:30329788
pythonvssor306:30344512
bridge0708:30335490
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 14
- Comments: 27 (1 by maintainers)
I found a fix. I simply uninstalled 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
I ran into this as well but I managed to get
code
command to work yesterday but it wasn’t working any more today. My problem was that thecode
was referring to an instance in a temporary folder. So I just removed/usr/local/bin/code
and then added it again from VSCode (after making sure that I launched VSCode from theApplications
).So essentially this: https://apple.stackexchange.com/a/294178
Note that I got it into my PATH by following the workaround here.
I also just ran into this issue, fresh install m1 macbook air.
this answer should be pinned to the top, thank you.
I solved it. 😃
Launch VsCode:
command
+shift
+p
->install code
.https://code.visualstudio.com/docs/setup/mac
Lazy-poet your fix worked. Thank you
This work for me too! Thank you!