46

I've download the Xcode 8 beta .xip file. I cannot unzip. Opening the file just sits there for hours saying "Verifying..."

If I try from command line I get the following...

Downloads unzip Xcode_8_beta.xip 
Archive:  Xcode_8_beta.xip
  End-of-central-directory signature not found.  Either this file 
  is not a zipfile, or it constitutes one disk of a multi-part archive.        

  In the latter case the central directory and zipfile comment will be
  found on the last disk(s) of this archive. unzip:  cannot find 
  zipfile directory in one of Xcode_8_beta.xip or Xcode_8_beta.xip.zip, 
  and cannot find Xcode_8_beta.xip.ZIP, period.
JAL
  • 41,701
  • 23
  • 172
  • 300
chris P
  • 6,359
  • 11
  • 40
  • 84

12 Answers12

61

The .xip file format contains an archive (xar containing a gzip archive and metadata) and a signature of the archive. The signature is important, since previously Xcode downloads have been altered (eg. XcodeGhost) to inject malicious code into apps. Therefore, approaches like skipping the verification (xattr -d com.apple.quarantine Xcode_8_beta.xip) seems irresponsible.

I strongly encourage you to try to open it with Archive Utility.app in your finder. If the signature check doesn't work, try re-downloading.

If you want to investigate whether the .xip is validly signed or for whatever reason want to expand it without Archive Utility, you can use pkgutil:

pkgutil --check-signature Xcode_8_beta.xip

The output should be something like this:

    Package "Xcode_8_beta.xip":
       Status: signed Apple Software
       Certificate Chain:
        1. Software Update
           SHA1 fingerprint: 1E 34 E3 91 C6 44 37 DD 24 BE 57 B1 66 7B 2F DA 09 76 E1 FD
           -----------------------------------------------------------------------------
        2. Apple Software Update Certification Authority
           SHA1 fingerprint: FA 02 79 0F CE 9D 93 00 89 C8 C2 51 0B BC 50 B4 85 8E 6F BF
           -----------------------------------------------------------------------------
        3. Apple Root CA
           SHA1 fingerprint: 61 1E 5B 66 2C 59 3A 08 FF 58 D1 4A E2 24 52 D1 98 DF 6C 60

If that signature isn't signed by an Apple Root CA that is in your Keychain, you should probably stop right there. If all is good so far, you can then run the following commands:

xar -xf Xcode_8_beta.xip
sudo tar zxvf Content
FredericJacobs
  • 726
  • 2
  • 5
  • 6
  • 1
    Are you sure `xattr -d com.apple.quarantine` skips verification? I doubt that as the signature should be inside the archive. Also I don't think you have to invoke tar via sudo. – Zorg Jun 20 '16 at 01:40
  • 3
    Archive Util was the only solution that worked for me. thanks! – gutte Jun 20 '16 at 08:01
  • I had to skip the verification to being able to unzip the thing. Shrugs. (pkgutil shoed it was a valid signature) – Cesar Varela Jul 08 '16 at 00:32
  • 30
    Can't untar. Getting error `tar: Unrecognized archive format`. Unable to extrac in GUI too. I'm running Yosemite. – ReDetection Jul 08 '16 at 16:18
  • 6
    Can't untar. Getting error tar: Unrecognized archive format. Unable to extrac in GUI too. I'm running El Captain 10.11.5. – imti Jul 25 '16 at 10:18
  • i update El Captain to Sierra beta and using Archive Utility i extract .xip and finally able to use Xcode beta 6. – Viraj Padsala Aug 20 '16 at 04:26
  • For those who have tried all of these steps and still aren't able to extract, try restarting your computer and go back to opening the XIP with Archive Utility. Worked for me. – commscheck Sep 08 '16 at 03:31
  • 2
    Archive Utility seems to be the only thing that works. You can kick it off with the command line using `osascript -e "tell application \"Archive Utility\" to open \"Macintosh HD:path:to:Xcode_8.xip\""`. It'll return right away though so you'll have to poll to see if the file exists or something to know when it actually completes. – JScott Sep 16 '16 at 16:01
  • 2
    Here's the Apple Script I'm using to do all that: https://gist.github.com/JScott/5be1c2770f2134b22a67d417fd91c895 e.g. `osascript unxip.scpt /tmp/Xcode_8.app` – JScott Sep 16 '16 at 16:44
  • Tried this method and also got the "tar: Unrecognized archive format" error. Ended up using xattr -d com.apple.quarantine Xcode_8_beta.xip and then using the standard Archive Utility tool to unzip the XCode.app file. – Android Noob Nov 06 '16 at 20:08
  • i do all the step with no errors but i miss how to install the xcode is there any step needed more after running all the steps should i see now the xcode8.2 in finder it display the following sudo tar zxvf /Volumes/ox/Xcode_8.2_beta_2.xip x Content x Metadata – Amr Angry Nov 17 '16 at 13:56
  • it work for me with archive utility after i update os to 10.11.6 – Amr Angry Nov 17 '16 at 15:32
  • Can't untar. Getting error tar: Unrecognized archive format. . I'm running Sierra. – NinjaCoder Jan 11 '17 at 19:28
38

I'm not sure why Archive Utility is having so much trouble with these archives, but as long as your download itself isn't corrupt, extracting the app bundle out manually works consistently for me. I'm on the 10.12 GM seed (16A320), by the way.

The Xcode.app bundle is inside of a CPIO archive, which is xz'd and then packed into a v2 (i.e., Yosemite) PBZX stream (like the payloads in the Yosemite/Sierra install packages). That resulting stream is what's bundled with some metadata and then signed for distribution. Getting it out of all that mess isn't hard, but it takes a little bit of effort.

(If you'd like to see what this looks like, here's a recording of me doing it just now, complete with file sizes and certificate SHA1 hashes.)

  1. Verify the signature and certificate chain that signed the archive.

    pkgutil --verbose --check-signature ./Xcode_8_GM_seed.xip
    
  2. Extract the PBZX stream from the archive.

    xar -xf ./Xcode_8_GM_seed.xip
    
  3. Obtain a PBZX v2 unpacker and... unpack the packed stuff.

    curl -O https://gist.githubusercontent.com/pudquick/ff412bcb29c9c1fa4b8d/raw/24b25538ea8df8d0634a2a6189aa581ccc6a5b4b/parse_pbzx2.py
    python parse_pbzx2.py Content
    
  4. Decompress the archive (there should only be one chunk, "part00").

    xz -d Content.part00.cpio.xz
    
  5. Unpack the CPIO archive as a privileged user (since the device frameworks have weird symlinks that make cpio complain otherwise, and it needs to be owned by root anyway) and move the resulting Xcode app bundle into /Applications.

    sudo cpio -idm < ./Content.part00.cpio
    sudo mv ./Xcode.app /Applications/
    

It should prompt you to do the post-install setup steps upon first launch.

Evan Kinney
  • 526
  • 5
  • 5
  • 6
    Thank you. Also after the step 3. you can use "The Unarchiver" app to unpack the Content.part00.cpio.xz. – krafter Sep 26 '16 at 12:31
  • 2
    When you don't have the xz tool on your system as it happened to me, you can replace step 4 with "sudo cpio -izmdu 0 – konran Nov 01 '16 at 01:15
  • I am seeing bunch of errors after executing "sudo cpio -izmdu 0 – NinjaCoder Jan 17 '17 at 18:23
  • 2
    @evan-kinney To extract `Content.part00.cpio.xz` you could use `tar`: `$ sudo tar -zxvf Content.part00.cpio.xz -C /Applications` – Bartosz Jan 18 '17 at 16:44
  • @NinjaCoder: did you double check in which directory you are positioned when running the command? it seems as if you've copied the .xz file to somewhere and cd'ed into that somewhere… – konran Jan 19 '17 at 13:55
  • As krafter mentioned after step 3 you can run: `tar xf Content.part00.cpio.xz` – iman May 19 '17 at 04:52
  • Should only be one chunk? I see three, only two of which are xz'ed. – Michael Mar 05 '20 at 21:02
31

The XIP file (extract in place) is just a special archive that verifies the unarchive with Apple. On a 2014 MacBook Pro i7 the Xcode 8 binary took over 30 minutes to extract. If the file is not making much progress after close to an hour, re-download the archive and try extracting again.

Additionally, Xcode 8.0 beta requires a Mac running macOS 10.11.4 or later. Make sure your system version is supported.

Xcode 8 Beta 2 note: macOS 10.11.5 or later is required to install Beta 2.

JAL
  • 41,701
  • 23
  • 172
  • 300
6

Open Terminal

1.cd drag drop your xcode (for path) then enter

2.xattr -d com.apple.quarantine Xcode-beta.xip enter

Shreyank
  • 1,549
  • 13
  • 24
  • 3
    This completely bypasses the signature checking on the xip file, defeating the purpose of this archive format. – sgonzalez Jul 27 '16 at 05:22
  • 9
    @sgonzalez Yeah... well some of us need to do work at some point. Would love if Apple could deploy stuff in a way that doesn't require me to dick around for 4 hours before LITERALLY EVERYTHING I try to do. But perhaps a disclaimer would be good. – mpowered Aug 31 '16 at 18:35
  • +1 to this one. I have a feeling I'll need it more often in the future. What's the reason for waiting for 30 minutes looking at "verifying the archive"? – Stanislav Dvoychenko Sep 08 '16 at 09:33
  • I was having some issues with Xcode 8 GM. I used the `pkgutil --check-signature` command by Frederic to check if the package was ok. After that the `xattr` command to skip the endless verification. Double click to extract and Bob's your uncle. – Yvo Sep 08 '16 at 21:47
  • @StanislavDvoychenko I am getting "xattr: XCode-8.2.1.xip: No such xattr: com.apple.quarantine" while running "Xaytr -d com.apple.quarantine XCode... Any ideas why? – NinjaCoder Jan 12 '17 at 21:12
6

I was consistently getting error messages about the archive being corrupt because I use The Unarchiver as my unpacker program. For whatever reason, it's unable to process the digital signature checking so manually choosing to open the .xip file with Archive Utility sorted the issue for me.

enter image description here

Scott
  • 2,753
  • 1
  • 24
  • 31
2

Restarting my system was what worked for me.

mSabu
  • 31
  • 4
2

I was also getting this error

  1. i update my mac OS x version to 10.11.6. i think 10.11.4 is the minimum OS x version on which Xcode 8 will run.

  2. Make sure you have 40 gb minimum space to unzip the Xcode_8_beta_5.xip or Xcode_8_beta_2.xip

then uncompress it. This Xcode version will take more space then the others.

OurangZeb Khan
  • 1,114
  • 18
  • 20
0

I was having the same problem even though I was running the latest el capitan (10.11.5). Based on Chris P's comment, I reinstalled OS X from Recovery (https://support.apple.com/en-us/HT204904), and then everything worked. Evidently something hadn't installed correctly in one of my previous updates from the App Store.

0

I was getting this error and I did the following:

The simple way is to upgrade your Mac OS x version 10.11.5 and try to unzip file using Archive Utility and it will extract the "XIP" file.

I upgraded my mac os and this helped me. I was able to get rid of unzipping error.

Hope this helps!

Dharmesh Siddhpura
  • 1,610
  • 12
  • 22
  • Exactly ! Supported Config - "Xcode 8 beta requires a Mac running macOS Sierra beta 3 or later, or OS X El Capitan 10.11.5 or later. " – Ramanan R R Aug 24 '16 at 05:43
0

Check your Xcode version it should be latest or as per Xcode Version. Hope this will resolve your problem.

Kamleshwar
  • 2,967
  • 1
  • 25
  • 27
0

Restarting System worked for me. Please, check with it. Or try closing all application, Xcode, simulator and all. Make sure Mac OS 10.11.5 onwards.

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
0

Using

Here's what I did:

  • Extracted on 10.12 using Archive Utility
  • Copied Xcode-beta.app to 10.11
  • Xcode-beta.app seems to work ok on 10.11.

On El Capitan, Archive Utility hangs when I try to extract the same downloaded .xip file that extracts on macOS Sierra using Archive Utility.

silvalli
  • 295
  • 2
  • 13