Skip to content

Instantly share code, notes, and snippets.

@mikolajwojcicki
Last active February 27, 2024 13:44
Show Gist options
  • Save mikolajwojcicki/4ca6e7003b166daf69a0b213ba1eedf0 to your computer and use it in GitHub Desktop.
Save mikolajwojcicki/4ca6e7003b166daf69a0b213ba1eedf0 to your computer and use it in GitHub Desktop.
Extracting apple .pkg files on Linux

In order to extract such a package following software is requried:

  • 7zip for general .pkg

  • pbzx for Payload files Github Source

    • xar Github Source
      • fix
      • download optional dependency libbzip2 / bzip2 and enable it in xar compilation configuration. This enables use or xar for extracting .pkg
    • compile with gcc pbzx.c -o pbzx -llzma -lxar

After all is installed and working, extract .pkg with 7zip, go into extracted directory and go into desired directory containing payload file. Then run pbzx -n /path/to/file | cpio -i in order to extract Payload file

NOTE: Bom files are quite possibly bzip2 compressed / encoded.

@FenixC4
Copy link

FenixC4 commented Oct 24, 2023

Then you can compile this project. It will allow you to compile macos binaries on linux after you extract take macOS_SDK from the extracted .pkg file

@mikolajwojcicki
Copy link
Author

Remember to run autogen before configure

@FenixC4
Copy link

FenixC4 commented Oct 26, 2023

Then you can compile this project. It will allow you to compile macos binaries on linux after you extract take macOS_SDK from the extracted .pkg file

remember to compile it with tapi support

also to solve dsymutil problem just use this

@FenixC4
Copy link

FenixC4 commented Oct 26, 2023

Also when compiling anything remember to check if all compiled or installed libraries are detected by ldconfig. If no then add their directory path to ld configuration

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