Extract .pkg and .mpkg files with xar on Linux

macOS installer packages have the .pkg extension which are xar archives, to extract them on Linux we need to download and compile xar from https://code.google.com/archive/p/xar/downloads.

Operating system:  Linux Debian 9 / kernel 4.9.0-3-amd64

1. Install dependencies

apt-get install build-essential libxml2-dev libssl1.0-dev zlib1g-dev

2. Download and extract xar-1.5.2.tar.gz

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/xar/xar-1.5.2.tar.gz
tar -zxvf xar-1.5.2.tar.gz

3. Build and install

cd xar-1.5.2
./configure
make
make install

4. Extract files with xar

xar -xvf package_installer.pkg

Leave a Reply

Your email address will not be published. Required fields are marked *