How to Extract Files from a PKG Archive on macOS
PKG files are macOS installer packages used for software that needs system-level installation — drivers, frameworks, system utilities, and enterprise software. While macOS handles PKG installation natively, inspecting the contents of a PKG file before running it is a smart security practice.
The default way to open PKG files on macOS
Tool: Installer.app / pkgutil (built-in)
$ pkgutil --expand package.pkg output_dirSteps
- To install: double-click the .pkg file and follow the installer wizard.
- To inspect contents before installing: pkgutil --payload-files package.pkg
- To expand the package: pkgutil --expand package.pkg output_dir
- To extract payload: cd output_dir && cat Payload | cpio -id
Extract individual files from a PKG archive
The default macOS tools extract everything — there's no way to pick individual files. MacPacker lets you browse PKG archive contents, preview files, and extract only what you need — without unpacking the entire archive.
A better way: open PKG files with MacPacker
MacPacker is a free, open-source macOS archive manager that supports PKG and 30+ other formats. Unlike the default tools, MacPacker lets you:
- Browse archive contents like a folder
- Preview files with Quick Look without extracting
- Extract individual files via drag and drop
- Navigate nested archives (archives within archives)
- Enjoy a native SwiftUI interface that feels right at home on macOS
Get MacPacker
v0.15.1 · macOS 14+$ brew install --cask macpackerApp Store updates may lag a few days behind direct downloads due to Apple review.
Frequently asked questions
How do I inspect a PKG file before installing on Mac?
Use MacPacker to open the .pkg file and browse its contents without installing. From Terminal, run: pkgutil --payload-files package.pkg to list the files it would install.
Can I extract a PKG file without installing it?
Yes. Use MacPacker to browse and extract specific files visually. From Terminal: pkgutil --expand package.pkg output_dir to expand the package structure.
Is it safe to open a PKG file on Mac?
PKG files run installer scripts that can modify your system. Always verify the source. Use MacPacker to inspect PKG contents before installing — you can see exactly what files it contains.
Related formats
DMG is Apple's native disk image format. It's the standard way to distribute macOS applications. macOS handles DMG files natively.
XAR (eXtensible ARchive) is Apple's archive format used internally for PKG installers and Xcode distributions.
ZIP is the most widely used archive format on macOS. It supports lossless compression and is natively handled by Finder and Archive Utility.