Skip to content

Instantly share code, notes, and snippets.

@nekator
Last active August 25, 2023 14:24
Show Gist options
  • Save nekator/fdf046b834e3221555db252e5120b622 to your computer and use it in GitHub Desktop.
Save nekator/fdf046b834e3221555db252e5120b622 to your computer and use it in GitHub Desktop.
install Xcode from terminal

1. Download Xcode from https://developer.apple.com/download/more/ (this requeires to Login in with an Apple Developer Account)

At the moment id don´t know how to authenticate so i have no clue to download the xip via curl/wget.
In my case i downloaded the file and copied it via scp to my mac.

eg. for Xcode 9.2 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_9.2/Xcode_9.2.xip

2. Verify Signature of xip file

pkgutil --verbose --check-signature path/to/xip

eg. pkgutil --verbose --check-signature Xcode_9.2.xip

3. Extract the PBZX stream from the archive

xar -xf path/to/xip

eg. xar -xf Xcode_9.2.xip

4. 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

5. Decompress the archive

Locate all Concent.partXX.cpio.xz file with more than 0Bytes and decompress them

xz -d Content.partXX.cpio.xz

6. Concat decompressed cpio files

for i in *.cpio; do cat $i >> Content.cpio; done

7. Unpack cpio

sudo cpio -idm < Content.cpio

8. Move Xcode to /Applications

sudo mv ./Xcode.app /Applications/
@farshadmb
Copy link

What is pbxz? Do you have any links?

Jonathan Levin pbzx to properly unpack pbzx chunks and pipe the output to tar

@Gerst20051
Copy link

Is that in a tap? I don't see it on homebrew.

https://formulae.brew.sh/formula/pbxz
https://formulae.brew.sh/cask/pbxz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment