permission denied
When installing multiple xcode versions, using a command such as:
xcversion install 11.3 --no-switch
There were occasionally errors such as this:
xip: error: The archive “Xcode_11.3.xip” failed to be moved to the final destination due to the error: The operation couldn’t be completed. Permission denied.
No `Xcode.app(or Xcode-beta.app)` found in XIP. Please remove /Users/administrator/Library/Caches/XcodeInstall/Xcode_11.3.xip if you suspect a corrupted download or run `xcversion update` to see if the version you tried to install has been pulled by Apple. If none of this is true, please open a new GH issue.
However,
- running the xcversion command again later, eventually everything succeeded. So, it was not consistent.
- If manually unzipping the file left at Users/administrator/Library/Caches/XcodeInstall/Xcode_11.3.xip , it did unzip ok.
The question is about those error messages. The above message included:
- Permission Denied.
Permission to do what? Permission on which file or directory? Could the message be more verbose?
- No
Xcode.app(or Xcode-beta.app)found in XIP.
Did not seem to be true, because I could manually unxip it. Also - if the problem really was " No Xcode.app(or Xcode-beta.app) found in XIP. " then why did it also say "permission denied"?
If this is an edge-case that nobody has ever encountered, the issue can probably be closed. Nevertheless, here are some ideas to mitigate it. Because the install process can be slow, any quick steps to precheck a success or failure are preferable to waiting many minutes to discover there is a problem.
-
Add a preflight check to "xcversion install" which occurs before downloading xcode or taking any actions. In the pre-check phase, make sure the user can write to the final destination folder. Write a very small file and then remove it. If the step fails, then clearly indicate which directory is lacking permissions.
-
Download the xip file. After the download, but before continuing further, verify the shasum, https://github.com/notpeter/apple-installer-checksums/blob/master/xcode.md . Display to the user that the download and checksum were successful. Unless, this is already being done, then nevermind :-)
This is happening to me today too. It's consistently failing every time for me, but the manual unxip works. I can't debug at all since running the command manually works and no useful information is being output by the xcversion command.