Auto update isn't working in VSCode: Could not create temporary directory: Permission denied
Asked Answered
P

5

41

From certain point I started getting this error from time to time(I suppose it fires when editor tries to check for updates), and manual/auto update doesn't work. The only way I can update the editor is re-download the app and replace it manually.

Does someone face same issue and successfully resolved?

Screenshot

Pelvis answered 5/4, 2019 at 23:12 Comment(0)
D
76

Try to type the following commands in a terminal:

cd ~/Library/Caches

sudo chown -R $(whoami):staff *
Discern answered 6/4, 2019 at 20:37 Comment(10)
Thanks, it worked, could you explain in your answer(or comment) what is in this directory and what is :staff ?Pelvis
chown changeowner . -R recursion * for all in this directory And you user with group stuff become founder of all in this directoryDiscern
This did the trick for me. There was actually several files/folders in the ~/Library/Caches folder owned by root:staff.Sycosis
how to handle when having multiple admin users on the macOS, the folder is with permission to user X and i'm user Y. should I just set the folder 775?Sigmund
@Discern what do you have to say about barney74's answer ?Engobe
thank you, @jcuypers, but which username is it? where can i locate the username i am using?Jolda
sudo chown -R <username>:staff * - in what directory is this supposed to be executed? home?Heriot
This one solves this error too: "Cannot use 'in' operator to search for 'instanceId' in 0" with a python debugger on vscodeEmperor
Didn't have com.microsoft.VSCode.ShipIt but Microsoft directory, received some permission denied for some apple objects, and VS Code is still complaining Could not create temporary directory: Permission denied with a sub-message Source: update service. VS Code 1.72.1.Babita
find ~/Library/Caches -uid 0 outputs the files/directories being owned by root (uid 0)Griselgriselda
E
80

The above solution works, but it is like using a sledge hammer to kill a house fly.

  1. Go to Caches cd ~/Library/Caches.
  2. Check ownership of folders. ls -la
  3. You will probably see drwxr--r-- 2 root staff 64 Nov 15 09:37 com.microsoft.VSCode.ShipIt
  4. Run sudo chown <username>:staff com.microsoft.VSCode.ShipIt

This allows you to only update that folder owner and won't touch the other folders. You can break over item unexpectedly.

Erlin answered 10/12, 2019 at 14:37 Comment(3)
If you're using VSCodium, the cache folder to fix is com.visualstudio.code.oss.ShipIt.Boarhound
This should be the accepted answer!Liquidize
@Liquidize agreed! This is a better solutionDiorite
D
76

Try to type the following commands in a terminal:

cd ~/Library/Caches

sudo chown -R $(whoami):staff *
Discern answered 6/4, 2019 at 20:37 Comment(10)
Thanks, it worked, could you explain in your answer(or comment) what is in this directory and what is :staff ?Pelvis
chown changeowner . -R recursion * for all in this directory And you user with group stuff become founder of all in this directoryDiscern
This did the trick for me. There was actually several files/folders in the ~/Library/Caches folder owned by root:staff.Sycosis
how to handle when having multiple admin users on the macOS, the folder is with permission to user X and i'm user Y. should I just set the folder 775?Sigmund
@Discern what do you have to say about barney74's answer ?Engobe
thank you, @jcuypers, but which username is it? where can i locate the username i am using?Jolda
sudo chown -R <username>:staff * - in what directory is this supposed to be executed? home?Heriot
This one solves this error too: "Cannot use 'in' operator to search for 'instanceId' in 0" with a python debugger on vscodeEmperor
Didn't have com.microsoft.VSCode.ShipIt but Microsoft directory, received some permission denied for some apple objects, and VS Code is still complaining Could not create temporary directory: Permission denied with a sub-message Source: update service. VS Code 1.72.1.Babita
find ~/Library/Caches -uid 0 outputs the files/directories being owned by root (uid 0)Griselgriselda
H
10

In my case, ~/Library/Caches/com.microsoft.VSCode.ShipIt was owned by root:staff all of a sudden. I fixed it by running the following command:

sudo chown -R $USER:'staff' ~/Library/Caches/com.microsoft.VSCode.ShipIt

(added single quotes around the group name because ZSH didn't like it)

Heriot answered 22/11, 2021 at 12:6 Comment(0)
A
0

I had a similar problem with update VSCode after supplemental update and bug fixes for my macOS Catalina 10.15.6 on 12.08.2020. I solved the problem with the manual update VSCode:

  1. goto last changes on the official site.
  2. Downloads: Windows: User System| Mac | Linux: snap deb rpm tarball
  3. mv ~/Downloads/Visual\ Studio\ Code.app/ ~/Applications/ or move/copy Visual Studio Code.app into Applications folder
  4. Launch the Visual Studio Code.app and enjoy the latest version.

After that, the application should auto update the new version without any problems !

Anacreontic answered 8/9, 2020 at 22:37 Comment(0)
A
0

I use the following script to manually download/install the new version (e.g. under /opt/). The old dir is backed-up. Also in case of network failure I can rerun the script to resume.

vscode-update

#!/bin/bash
set -e
cd /opt/
datetime=$(date +"%Y-%m-%d_%H%m%S")
dateonly=$(date +"%Y-%m-%d")
downloadedfile="vscode_download_$dateonly.tar.gz"
backupfile="VSCode-linux-x64_backup_$datetime"
url=https://update.code.visualstudio.com/latest/linux-x64/stable


echo "Downloading $url --> $(pwd)/$downloadedfile"
wget --continue -O "$downloadedfile" $url

echo "backing up old vscode under: $backupfile"
mv VSCode-linux-x64/ "$backupfile"

echo "extracting: $downloadedfile"
tar xvzf "$downloadedfile"

echo "UPDATE DONE!"

Abel answered 7/4, 2021 at 20:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.