.pkg

What is a .pkg file?

macOS Installer Package · Disk image · Apple · 2000s

On a Mac, a PKG is an installer package: double-click it and macOS's Installer walks you through setting up the software, copying files and running any needed scripts. The .pkg extension is also reused by other systems for unrelated package data.

Category
Disk image
Type
Binary
Is a .pkg file safe to open? A macOS PKG installs software and can run scripts with elevated privileges, so only open packages from the developer or a source you trust.

What is a .pkg file used for?

A macOS flat package is a xar archive holding the files to install plus scripts, which the Installer app runs. It is used when a simple drag-to-Applications DMG is not enough, for example when system files or background components are involved.

To install one, double-click and follow the steps. To look inside without installing, tools like Pacifist or the xar command can list and extract the contents.

Be aware the .pkg name is not exclusive to macOS; some games and other software use it for their own data packages, so context tells you which kind you have.

What opens a .pkg file?

The .pkg format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.

Windows

  • Not applicable for macOS packages

macOS

  • Double-click to install
  • Pacifist (to inspect)
  • xar (command line)

Linux

  • xar (to inspect, for macOS packages)

Web

  • Not applicable

Open a .pkg file step by step

  1. Confirm the file really is a .pkg. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with Not applicable for macOS packages.
  3. On Mac, use Double-click to install or Pacifist (to inspect).
  4. On Linux, try xar (to inspect, for macOS packages).
  5. Still stuck? Convert the .pkg to Not convertible, which opens more widely.

Why can't I open my .pkg file?

Almost always because no installed app understands PKG. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .pkg at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .pkg file

You can convert a .pkg file to Not convertible using a conversion tool or the export menu of an app that opens it.

What is the .pkg file signature (magic bytes)?

A .pkg file starts with the hex bytes 78 61 72 21, which read as xar! in ASCII. Programs identify PKG by those bytes, not by the filename, so a renamed file still gives itself away.

These are the documented signatures for PKG. For a full breakdown, see the xar (macOS .pkg) file signature page.

Documented magic-byte signatures for the .pkg format
Hex signatureOffsetASCIINote
78 61 72 210xar!'xar!' (a macOS flat package is a xar archive); the .pkg name is also reused by other systems for unrelated data

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .pkg file?

On a Mac, a PKG is an installer package: double-click it and macOS's Installer walks you through setting up the software, copying files and running any needed scripts. The .pkg extension is also reused by other systems for unrelated package data.

How do I open or install a PKG file on a Mac?

Double-click it and follow the Installer prompts. To inspect one without installing, open it in the free Pacifist, which can also extract individual files.

Is a .pkg file safe?

A macOS installer package can change your system and run scripts, so only run ones from the official developer. If macOS warns that a package is from an unidentified developer, stop unless you are certain of the source.

Related formats

Sources

Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.