xcpretty / xcode-install

🔽 Install and update your Xcodes
https://fastlane.tools
MIT License
2.59k stars 239 forks source link

xcversion failed to download Xcode 11 Beta #340

Closed the-freshlord closed 5 years ago

the-freshlord commented 5 years ago

Hi,

I am having an issue with installing Xcode 11 Beta. When installing, I get Warning: Transient problem: FTP error Will retry in 1 seconds. 3 retries left.

Screen Shot 2019-06-05 at 7 31 07 PM

I am currently using 2.5.0. If I install it manually from the download page, it works fine.

grantjbutler commented 5 years ago

I'm also seeing this issue after installing from master (specifically, the commit 71d27775a60858d73aa26c7ad93be12882d8d202) to try to work around #339.

jazaval commented 5 years ago

@SwiftyGuerrero @grantjbutler does this persist for you after deleting ~/Library/Caches/XcodeInstall?

the-freshlord commented 5 years ago

@jazaval removing the cache works. But I then get this error:

Screen Shot 2019-06-09 at 10 33 21 PM
jazaval commented 5 years ago

Did some digging on issues installing the new Xcode 11 beta...

The Xcode 11 beta application bundle has some invalid symlinks that do not pass sptctl -assess (triggered by the verify_app_security_assessment method).

I verified an un-xip'd bundle from Apple:

$ /usr/sbin/spctl --assess --verbose=4 --type execute Xcode-11.app
Xcode-11.app: rejected (invalid destination for symbolic link in bundle)
override=security disabled
origin=Software Signing

upon this failure, xcode-install will delete the copied bundle (see https://github.com/xcpretty/xcode-install/blob/master/lib/xcode/install.rb#L257) from it's destination folder (/Applications/).

I deleted broken symlinks in the bundle:

$ find . -type l ! -exec test -e {} \; -delete

and re-ran:

$ /usr/sbin/spctl --assess --verbose=4 --type execute Xcode-11.app
Xcode-11.app: accepted
override=security disabled

So the only real option (other than "cleaning" the bundle when installing) would be to skip the verify_app_security_assessment method based on some install options or if the Xcode is a beta. @KrauseFx @segiddins @jpsim would you be open to a PR with this behavior to unblock beta installs?

jazaval commented 5 years ago

Interestingly, it appears codesign is less stringent, but still does the basic evaluation of the application bundle signature:

$ /usr/bin/codesign --verify --verbose Xcode-beta.app/
Xcode-beta.app/: valid on disk
Xcode-beta.app/: satisfies its Designated Requirement
$ /usr/sbin/spctl --assess --verbose=4 --type execute Xcode-beta.app/
Xcode-beta.app/: rejected (invalid destination for symbolic link in bundle)
jazaval commented 5 years ago

Xcode 11 Beta 2 also has this issue.

ykhandelwal913 commented 5 years ago

With each version, apple comes with something new and makes this automation break. Specially the Beta releases.

Comnir commented 5 years ago

I tried to skipverify_app_security_assessment as suggested above, but verify_app_cert fails as well:

/Library/Ruby/Gems/2.3.0/gems/xcode-install-2.5.900/lib/xcode/install.rb:701:in `verify_app_cert': undefined method `include?' for nil:NilClass (NoMethodError)

Line 701 is

apple_authority_result = cert_info['authority'].include?(AUTHORITY)

I printed cert_info to debug and saw Authority is missing from the dictionary:

{"bundle_identifier"=>"com.apple.dt.Xcode", "team_identifier"=>"59GAB85EFG"}
zeelax commented 5 years ago

Just installed Xcode 11 Beta 5, went without any issues. Beta 4 was still failing to pass the spctl's assessment.

nancy-gomez commented 5 years ago

Same as @Comnir I'm also experiencing this after upgrading to xcode-install 2.6.0 to download Xcode 11 Beta 5.

I wanted to utilize the two fixes (Application being downlaoded into Downloads and the xip instead of Archive Utility fix)

~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/xcode-install-2.6.0/lib/xcode/install.rb:692:in `verify_app_cert': undefined method `include?' for nil:NilClass (NoMethodError)

The strange part is that the file was fully unxipped and I even was able to open and launch this Xcode "unverified" application 🤔

nancy-gomez commented 5 years ago

No updates on this issue? I have tested this yet again with Xcode 11 Beta 7 and it fully downloads but for some reason hangs when completed. I can open the Xcode and everything but for some reason the command doesn't signal it completed. I also tested this with 10.2.1 and that one worked fine 🤔

jazaval commented 5 years ago

@nancy-gomez using #341 resolves this for me, but hasn't been merged yet - can you try using that branch and verify that it does for you too? @marcomorain @joshdholtz have reported success as well.

joshdholtz commented 5 years ago

Thanks for verifying! I will get that PR merged in and pushed out today 😊

nancy-gomez commented 5 years ago

Unfortunately still not working on my end :(

Both /usr/sbin/spctl --assess --verbose=4 --type execute /Applications/Xcode-11.Beta.7.app And /usr/bin/codesign --verify --verbose /Applications/Xcode-11.Beta.7.app hang indefinitely

I'll have to continue using --no-install and explicitly unxipping for now :/

Update: As I typed this the spctl command finished executing (I ran it after the codesign one) :O Update: Codesign also completed successfully but holy did it take forever

This will likely cause a timeout via our Ansible playbook :'( So even though both worked, not sure we can utilize