“Show Package Contents” Unavailable? Extract .pkg Files Without Installing Them

Sep 26, 2011 - 5 Comments

Extract Package (.pkg) file contents without installing them in Mac OS X

Have you ever wanted to get a look at the contents of a package file on the Mac, but without installing it? You can do that with the help of an excellent command line. This continues on with our series of inspecting the contents of app installers, and in this case we’ll demonstrate how to extract package files and sort through their contents without actually installing them onto Mac OS X.

How to View & Extract Package Files in Mac OS X Without Installing

There are actually two ways to view and extract package files on the Mac, without actually installing the package. The first approach is through the Finder, and the second approach is with the command line. Let’s cover the Finder method first, and then show you how to extract a package without installing via command line.

How to View Package Files with “Show Package Contents” in Mac Finder

The first method is quite easy and available from the Mac Finder, it is well known by advanced users:

  1. Navigate to the package file in the Finder
  2. Now right-click on the pkg file and select “Show Package Contents”

However, “Show Package Contents” isn’t always displayed as an option. In fact sometimes “Show Package Contents” is not available or not showing up at all, depending on how the package was arranged and created from the get-go. In such a situation, you can then turn to the command line to extract a package file.

How to Expand a Package File on Mac by Command Line

Assuming the ‘Show Package Contents’ option is unavailable, we can extract .pkg files using a command line tool called pkgutil that is bundled with Mac OS, which is what we’re going to focus on here.

  1. Launch Terminal (found in /Applications/Utilities/) if you have not done so already
  2. Use the following syntax, pointing the path to the package file in question, and providing an output destination for the files to be extracted from the package
  3. pkgutil --expand /path/to/package.pkg /output/destination/

    Hint: recall that you can drag & drop items into the Terminal to print their full path, making this tip easier by typing:

    pkgutil --expand [drop file here] /destination/path/

  4. Go to the outputs path in the Finder and check out the extracted files yourself, or navigate to the directly with the ‘cd’ command at the command line

Extract package files

You’ll notice that some package files contain even more package files, quickly leading you into a deeply nested package extraction process.

This is an excellent way to see what’s contained within packages, particularly the ones where the alt-click “Show Package Contents” option isn’t available, which is increasingly common starting from Mac OS X Lion and later releases of Mac OS system software, although ultimately it depends on how the package was constructed.

There are other methods of checking out package contents as well, including third party apps like Pacifist. If you have any particular tips or tricks for viewing and extracting package files on the Mac, let us know in the comments below!

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: William Pearson in Mac OS X, Tips & Tricks

5 Comments

» Comments RSS Feed

  1. Parakeet says:

    Try Pacifist for a GUI option

  2. Andrew says:

    Pacifist website states that at present, it is *not* compatible with OS X 10.7, but an update is in the pipeline.

  3. […] to grab a file out of a .pkg file? Maybe you want to see what’s inside of a pkg without installing it? No sweat, pkgutil does the […]

  4. Charksoki says:

    I have had the same issue before with pkg files as well as .app files that I want to explore, particularly if I right-clicked on the app when in “Applications” folder or the Downloads folder.

    So I found a workaround.

    First you right click on the app and choose “Open in New Tab” in Finder

    Then you right click on the package or .app, and choose “Show Package Contents”

    Let me know if that worked for you.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac