Search This Blog

Mac OS X: extract files from .pkg installer packages

  • To list the contents of the .pkg:
    gunzip  -c /path/to/XXX.pkg/Contents/Archive.pax.gz | pax
    
    For example:
    gunzip  -c /Volumes/iMac\ EFI\ Updater/iMacFirmwareUpdate.pkg/Contents/Archive.pax.gz | pax
    
  • To extract a specific file from the .pkg:
    gunzip -c /path/to/XXX.pkg/Contents/Archive.pax.gz | pax -r -s ":old-path:new-path:" "old-path-to-file"
    
    For example, I want to extract LOCKED_IM61_0093_07B.fd from the package. First, I need to find its full path inside the package using the following command:
    $ gunzip  -c /Volumes/iMac\ EFI\ Updater/iMacFirmwareUpdate.pkg/Contents/Archive.pax.gz | pax | grep LOCKED_IM61_0093_07B.fd
    ./Applications/Utilities/iMac EFI Firmware Update.app/Contents/Resources/LOCKED_IM61_0093_07B.fd
    
    then I can run the following command to extract it from the package to the current directory:
    gunzip  -c /Volumes/iMac\ EFI\ Updater/iMacFirmwareUpdate.pkg/Contents/Archive.pax.gz | pax -r -s ":./Applications/Utilities/iMac EFI Firmware Update.app/Contents/Resources:.:" "./Applications/Utilities/iMac EFI Firmware Update.app/Contents/Resources/LOCKED_IM61_0093_07B.fd"
    

No comments:

Post a Comment