flppv
flppv

Reputation: 4289

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

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

Upvotes: 41

Views: 14750

Answers (5)

Milovan Tomašević
Milovan Tomašević

Reputation: 8673

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 !

Upvotes: 0

pakhilov
pakhilov

Reputation: 884

Try to type the following commands in a terminal:

cd ~/Library/Caches

sudo chown -R $(whoami):staff *

Upvotes: 76

szx
szx

Reputation: 6926

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)

Upvotes: 10

Jannis Ioannou
Jannis Ioannou

Reputation: 2201

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!"

Upvotes: 0

barney74
barney74

Reputation: 866

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.

Upvotes: 80

Related Questions