Skip to content

Instantly share code, notes, and snippets.

@sunnyyoung
Last active December 17, 2020 09:05
Show Gist options
  • Save sunnyyoung/43cc954c3c7b54bf36902ad9c2d91281 to your computer and use it in GitHub Desktop.
Save sunnyyoung/43cc954c3c7b54bf36902ad9c2d91281 to your computer and use it in GitHub Desktop.
A shell function easy to unpack PKG file.
# unpkg
# Usage: unpkg xxx.pkg
unpkg() {
filepath=$(dirname -- "$1")
filename=$(basename -- "$1")
input="$filepath/$filename"
output="$filepath/${filename%.*}"
pkgutil --expand $input $output
find $output -type f -name 'Payload' -exec tar -xf {} -C $filepath \;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment