Skip to content

Instantly share code, notes, and snippets.

@phracker
Created August 5, 2018 20:40
Show Gist options
  • Save phracker/1944ce190e01963c550566b749bd2b54 to your computer and use it in GitHub Desktop.
Save phracker/1944ce190e01963c550566b749bd2b54 to your computer and use it in GitHub Desktop.
Unpack XIP on Linux

Unpacking XIP files on Linux:

  1. Install xar from https://mackyle.github.io/xar/
  2. Install pbzx from https://github.com/NiklasRosenstein/pbzx (use gcc -llzma -lxar -I /usr/local/include pbzx.c -o pbzx and copy the binary into your PATH)
  3. use xar -xf XIP_FILE -C /path/to/extract/to
  4. Change to the directory where you extracted the file.
  5. Use pbzx -n Content | cpio -i to extract the contents.
@PiRK
Copy link

PiRK commented Apr 26, 2023

Alternatively, with less patching & compiling required: use the tool developed by bitcoin

https://github.com/bitcoin-core/apple-sdk-tools

python extract_xcode.py -f Xcode_11.3.1.xip | cpio -d -i

@Abyss-W4tcher
Copy link

Abyss-W4tcher commented Oct 4, 2023

Hi, the following worked for me (inverted lib order while linking) :

sudo ldconfig # after installing xar
gcc pbzx.c -o pbzx -llzma -lxar

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