XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.66k stars 122 forks source link

Running xcodes install with sudo fails with "Could not find version" #225

Closed ghost closed 1 year ago

ghost commented 1 year ago

I am migrating from xcode-install / xcversion to this tool, which we use to automate installing Xcode in CI.

Trying to run sudo xcodes install <version> seems to always fail with Could not find version <version>

For example:

➜  ~ sudo xcodes install "14.0.1"
Password:
Could not find version 14.0.1.

➜  ~ xcodes install "14.0.1"

Downloading with aria2

Same thing happens with version 14.0 as well.

The version is there for sure, I have run xcodes update and added a check:

➜  ~ xcodes list | grep 14.0
14.0 Beta (14A5228q)
14.0 Beta 2 (14A5229c)
14.0 Beta 3 (14A5270f)
14.0 Beta 4 (14A5284g)
14.0 Beta 5 (14A5294e)
14.0 Beta 6 (14A5294g)
14.0 (14A309) (Installed, Selected)
14.0.1 (14A400)

I need to run it with sudo since the install requires the user credentials according to the documentation, and this is running in CI in a non-interactive shell.

MattKiazyk commented 1 year ago

@akselilukkarila Can you sudo xcodes update first?

Believe the sudo makes it save the list somewhere else.

ghost commented 1 year ago

@akselilukkarila Can you sudo xcodes update first?

Believe the sudo makes it save the list somewhere else.

Thanks, running sudo xcodes update first works 👍🏻 Maybe this could be mentioned in the documentation

rpendleton commented 1 year ago

This is partly related to a recent regression in 1.0.0, where running xcodes install no longer updates the list of Xcodes automatically when using the Xcode Releases data source. My PR for #226 should fix that regression, and it also makes it so the update will run automatically if the requested version is unknown.