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

flppv
  • 4,111
  • 5
  • 35
  • 54

5 Answers5

79

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.

Radu Chiriac
  • 1,374
  • 3
  • 18
  • 34
barney74
  • 856
  • 6
  • 4
75

Try to type the following commands in a terminal:

cd ~/Library/Caches

sudo chown -R $(whoami):staff *
wzr1337
  • 3,609
  • 5
  • 30
  • 53
pakhilov
  • 874
  • 7
  • 5
  • 5
    Thanks, it worked, could you explain in your answer(or comment) what is in this directory and what is `:staff` ? – flppv Apr 07 '19 at 07:44
  • 3
    chown changeowner . -R recursion * for all in this directory And you user with group stuff become founder of all in this directory – pakhilov Apr 08 '19 at 19:12
  • This did the trick for me. There was actually several files/folders in the `~/Library/Caches` folder owned by `root:staff`. – BogeyMan Aug 21 '19 at 00:43
  • 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? – Mateus Silva Jul 10 '20 at 15:51
  • @pakhilov what do you have to say about barney74's [answer](https://stackoverflow.com/a/59269643/13929340) ? – A P Jo Sep 24 '20 at 06:34
  • thank you, @jcuypers, but which username is it? where can i locate the username i am using? – yts61 Oct 26 '20 at 03:31
  • `sudo chown -R :staff *` - in what directory is this supposed to be executed? home? – szx Nov 22 '21 at 12:03
  • This one solves this error too: "Cannot use 'in' operator to search for 'instanceId' in 0" with a python debugger on vscode – Ivan Camilito Ramirez Verdes Jan 03 '22 at 16:26
  • 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. – Rafs Oct 26 '22 at 08:14
  • `find ~/Library/Caches -uid 0` outputs the files/directories being owned by root (uid 0) – simon04 May 20 '23 at 18:30
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)

szx
  • 6,433
  • 6
  • 46
  • 67
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 !

Grey Vugrin
  • 455
  • 5
  • 12
Milovan Tomašević
  • 6,823
  • 1
  • 50
  • 42
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!"

Jannis Ioannou
  • 1,692
  • 1
  • 14
  • 17