125

As Xcode 8 beta is available to download, I see it's distributed with a .xip extension, Xcode_8_beta.xip.

What is the .xip format? What's the difference between previous .dmg format?

0

5 Answers 5

148

According to the xip manual page:

A XIP file is an analog to zip(1), but allows for a digital signature to be applied and verified on the receiving system, before the archive is expanded. When a XIP file is opened (by double-clicking), Archive Utility will automatically expand it (but only if the digital signature is intact).

Essentially, an .xip file is just a .zip with a signature to verify that the file has not changed since its creator saved it. This protects from both damage from a disk error and from a third-party tampering with the file.

1
  • Unless there's some kind of CA for these files, couldn't an adversary just re-sign the archive? May 5, 2021 at 20:32
55

The .xip file format contains an archive (xar containing a gzip archive and metadata) and a signature of the archive.

To decode an .xip file, use the following commands:

pkgutil --check-signature <xip-file>
xar -xf <xip-file>
tar -zxvf <xar-file>

See the following links where developers discuss this format and its implications:

Not for Public Use

Apple has since removed xip from public use. The format has been reserved for Apple's exclusive use in the future, see TN2206:

Important: Starting with macOS Sierra, only XIP archives signed by Apple will be expanded. Developers who have been using XIP archives will need to move to using signed installer packages or disk images.

8
  • 1
    That didn't work for me for Xcode_8_GM_seed.xip. After using xar, I was left with what appears to be a pbzx file instead of a gzip archive.
    – zeroimpl
    Sep 10, 2016 at 21:01
  • 1
    xar -xf Xcode_8.xip has produced zero files under 10.11.4 Sep 19, 2016 at 6:55
  • 1
    If the xip can be expanded, the files will be in the same folder as the original. According to @AntonTropashko it is likely no files will be produced. Oct 22, 2016 at 13:15
  • 2
    It sure looks like XIP files are varying by date produced, I was able to get a "Contents" and "Metadata" file extracted, with Contents having seemingly raw data that wasn't xz compressed.
    – Spotlight
    Jul 15, 2017 at 10:40
  • 2
    My first guess would be that the contents of the Metadata file indicates the compression used for the raw data. Given Apple have re-appropriated the format for private use, they are able to change it without public documentation. Jul 15, 2017 at 12:44
4

To my knowledge xip is a xar derivative using gzip compression, with a toc header xml containing checksum, timestamp, certificates, user id/name, creation/modification/access date&time etc.

1

The Unarchiver and command line (xar, tar) utilities didn't work for me on MacOS 10.12.6. What did work was right clicking on the .xip file and select "Archive Utility", it was able to expand the .xip file successfully.

enter image description here

7
  • 1
    Were you able to install xcode using the .xip file? Oct 3, 2018 at 16:01
  • Yes, double clicking on the .xip file extracts the XCode application. It doesn't copy it to the Applications folder so you will have to do that part yourself.
    – mbonness
    Oct 3, 2018 at 16:21
  • If I have an Xcode 10 and after clicking on .xip Xcode 11, it will replace the previous one? And should I copy it to the Applications folder?
    – Oliver D
    May 7, 2020 at 17:36
  • @OliverD it is possible to install side by side versions of XCode in case you wanted to run both XCode 10 and XCode 11, just give them different names in your Applications folder. Otherwise if you don't need XCode 10 any more I would probably recommend to drag the old XCode.app into the trash.
    – mbonness
    May 8, 2020 at 18:28
  • @mbonness Well, I don't need Xcode 10, So should drag the XCode 10 before setup Xcode 11, Or not matter?
    – Oliver D
    May 8, 2020 at 19:57
1

For future reference, the shell command

xip --expand /path/to/Xcode_x.y.xip

also works, and extracts Xcode into the shell's current directory, so cd /Applications (or wherever) first.

I'd also strongly recommend removing or or renaming any existing copies of Xcode.app (or Xcode-beta.app) from the target location before using this command†.

As far as I know, this has worked as long as Apple has been distributing Xcode in .xip format, and it worked just now on 10.15.6 to expand Xcode_11.7.xip downloaded from Apple's developer site.

† While I haven't personally tested overwriting with xip, if similar command-line tools are any indication, it could potentially leave a mess if used to overwrite an existing directory with the same name, leaving behind existing files that don't exist in the archive being extracted, or worse.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .