📦 What is a PKG File?
On a Mac, a PKG file is an installer package, a single file that carries a program along with the instructions macOS needs to set it up. Its .pkg ending is the giveaway, and double-clicking it hands the whole thing to the built-in macOS Installer.
Picture it as a guided setup wrapped into one tidy file. Rather than making you copy pieces into place by hand, a PKG holds the finished software plus a script that knows exactly where each part should go, which folders to create and what to configure along the way. When you run it, the Installer reads those instructions, asks for your admin password and puts everything where it belongs. That is why installing many Mac programs is just a matter of opening a PKG and clicking through a few screens.
If you have used Windows, the closest thing you already know is an MSI installer, and a PKG plays the same role on macOS that MSI plays there. Developers reach for the format when a program needs more than a simple drag into the Applications folder, for example when it has background components, system settings or several parts that must land in specific places. Behind its friendly click-through face, a PKG is really an organised bundle of files and setup logic, and the sections below open it up.
📌 PKG File Quick Facts
| What it is | A macOS software installer package |
| Extension | .pkg |
| Opened by | The macOS Installer app |
| Holds | Program files, install scripts and metadata |
| Under the hood | A XAR archive with a directory inside |
| Windows equivalent | MSI installer |
| Also seen on | PlayStation and some Unix systems |
🧩 What a PKG Contains
A PKG is not the running program itself, it is the delivery box that carries the program and knows how to unpack it correctly onto your Mac.
Inside you will find the software's actual files, the executables and supporting pieces the app needs, kept together with everything that makes a clean install possible. Alongside them sit install scripts, small programs that run during setup to do jobs like creating folders, setting permissions or registering a background service. There is also metadata, a set of notes describing the package such as its name, version and where its contents should be placed. Some packages carry a signature too, a stamp that lets macOS confirm the package really came from the developer it claims and has not been altered.
Technically all of this is held in a XAR archive, a container format with a neat directory structure inside, which is why tools that understand archives can peer into a PKG. That combination of payload, scripts and description is what separates a true installer from a simple folder of files. The payload is the software, the scripts carry out the setup, and the metadata ties it together so macOS can install, verify and later remove the program cleanly.
📥 How to Install a PKG File
Installing a PKG on a Mac is designed to be easy, and there are two routes, the everyday double-click and a terminal command for those who prefer it or need to automate the job.
The simple way
Just double-click the PKG. The macOS Installer opens and guides you through a short series of screens, showing what will be installed and asking you to agree and continue. Partway through it asks for your administrator password, since placing software on the system needs permission, and after a moment the program is installed and ready. This click-through path suits almost everyone almost all of the time.
The terminal way
People who manage many Macs, or who want to script an installation, can run a PKG from the command line instead. The installer command does the work, taking the package and a target, and it is handy when clicking through screens on machine after machine is not practical.
Installing from Terminal
# Install a package onto the main drive $ sudo installer -pkg /path/to/app.pkg -target / # You will be asked for your admin password
🔐 Signed, Notarized and the "Unidentified Developer" Message
Before a PKG installs, macOS runs a security check, and knowing how it works explains the warning many people hit when a package will not open.
Apple's protection here is called Gatekeeper. When you open a package that came from outside the App Store, it looks for two things, a Developer ID signature that proves who made the package and confirms it has not been tampered with, and notarization, which means Apple has already scanned the package for known malware. A package that carries both installs without fuss. One that is missing either is stopped, and you see a message saying it is from an unidentified developer or that macOS cannot check it for malicious software.
That warning is a caution rather than a dead end. If you trust where the file came from, you can let it through by opening the Privacy and Security settings, where macOS offers a button to open the blocked package anyway, or by right-clicking the file in Finder and choosing Open. The advice, though, is the same as for any installer you download, which is to only override the block for software from a source you are sure of. A package from a developer's own site or the App Store is normally fine, while one from an unfamiliar link deserves a second thought before you wave it past the check. Developers who want their packages to sail through are expected to sign every part from the inside out and then notarize the finished installer, so a package that still triggers the warning has usually skipped one of those steps.
🔍 Looking Inside Without Installing
Sometimes you want to see what a PKG holds before committing to running it, and because it is really an archive there are a few ways to peek inside.
The quickest, when a package allows it, is to right-click it in Finder and choose Show Package Contents, which opens it like a folder to browse. Many modern packages are built as a single flat file, however, and those do not offer that option. For those, the pkgutil tool in Terminal can expand a package into a folder you can explore, and the command-line xar tool can list or pull out its parts. On Windows or Linux, where you cannot install a Mac PKG at all, an archive manager such as 7-Zip can still open it and show the files within, which is a useful way to check the contents even without a Mac.
Expanding a package to explore it
# Expand a flat package into a folder $ pkgutil --expand app.pkg expanded-folder # List what a package would install $ installer -pkg app.pkg -pkginfo
🗑️ How to Uninstall Software from a PKG
One thing that surprises people is that macOS has no single button to undo a PKG installation, because a package installs software but does not leave behind an uninstaller of its own.
For an ordinary app that a package dropped into the Applications folder, removing it is as simple as dragging that app to the Trash. The complication comes with packages that scatter pieces into system folders, since those parts are not obvious to find by hand. macOS does keep a record of what each package placed, called a receipt, and the pkgutil tool can read it. Running pkgutil with the pkgs option lists the identifiers of everything installed, and asking it for the files under a given identifier shows exactly what that package put on disk and where. The receipt itself can then be cleared with the forget option, which tells macOS to stop tracking that package, though it does not delete the files for you. These receipts live in a system folder that macOS maintains, and a companion command can read the same record to print the full list of paths a package laid down, which is what a careful manual removal works through.
Finding and clearing what a package installed
# List the IDs of installed packages $ pkgutil --pkgs # See what one package placed and where $ pkgutil --files com.example.app # Clear the receipt (does not remove the files) $ sudo pkgutil --forget com.example.app
Because tracing and deleting each piece by hand is fiddly and easy to get wrong, many people prefer a dedicated uninstaller app that reads the same receipts and removes everything for you. Whichever way you go, the key point is that clearing a receipt only stops the tracking, so the actual files still need removing to fully undo an install.
⚖️ PKG vs DMG
Grab an app for your Mac and the download tends to arrive as one of two things, a PKG or a DMG, and though both put software on your machine they go about it in quite different ways, so telling them apart is useful.
A PKG runs an installer. Opening it launches the macOS Installer, which follows the package's built-in instructions to place files, run setup scripts and configure the system, then finishes with the program installed. A DMG, short for disk image, is more like a virtual disk that appears on your desktop when opened. Inside a typical DMG you simply drag the application into your Applications folder to install it, with no guided steps. Put simply, a PKG does the work for you through a wizard, while a DMG hands you the app to place yourself.
Developers pick between them based on what the software needs. A straightforward app that only has to sit in the Applications folder is often shipped as a DMG, since dragging it across is all that is required. Something more involved, with background services, system-level pieces or setup that must happen in a set order, is better served by a PKG and its scripted install. Neither is better in general, they simply fit different jobs.
| Aspect | PKG | DMG |
|---|---|---|
| What it is | An installer package | A disk image |
| Installing | Guided wizard runs scripts | Drag the app to Applications |
| Best for | Software needing setup steps | Simple drag-and-drop apps |
| Runs on | macOS only | macOS only |
🪟 PKG vs MSI
If you move between Macs and Windows PCs, the clearest way to place a PKG in your mind is next to the Windows MSI, because the two play the same part on their own systems.
An MSI is Windows' own installer package, handled by the Windows Installer service, just as a PKG is the macOS installer package handled by the macOS Installer. Both bundle a program together with the instructions to set it up, both run a guided install, and both let system administrators roll software out across many machines in a controlled way. The differences are the ones you would expect from two separate platforms. A PKG is a XAR archive that runs only on macOS, while an MSI uses its own database-style format and runs only on Windows, so neither will install on the other's system. When a program is offered for both platforms, the developer simply provides a PKG for Mac users and an MSI, or an EXE, for Windows users.
| Aspect | PKG | MSI |
|---|---|---|
| Platform | macOS | Windows |
| Handled by | macOS Installer | Windows Installer |
| Role | Guided software install | Guided software install |
| Under the hood | XAR archive | Installer database format |
🎮 Other Kinds of PKG File
The .pkg ending is not owned by macOS alone, and while the Mac installer is by far the most common meaning, a few other systems use the same three letters for their own package files.
The best known of these is on PlayStation. Sony uses .pkg for content downloaded from the PlayStation Store, such as games, add-ons and demos, in a proprietary encrypted form meant to run on a PlayStation console rather than a computer. These files are tied to Sony's hardware and often need an accompanying licence file to work, so they behave nothing like a Mac installer despite sharing the extension. The .pkg ending also appears on some Unix-style systems, notably Solaris, where it marks a software package in that world's own format. Because of this overlap, the safe first step with any .pkg is to consider where it came from, since a file from a Mac developer, the PlayStation Store and a Unix server are three unrelated things that happen to share a name.
❓ Frequently Asked Questions
On a Mac, a PKG file is an installer package, a single file that carries a program together with the scripts and details macOS needs to set it up. When you double-click it, the built-in macOS Installer reads those instructions, asks for your admin password and places everything where it belongs. It plays the same role on macOS that an MSI installer plays on Windows. The same .pkg extension is also used by PlayStation and some Unix systems for their own package files, but on a Mac it means a software installer.
Double-click it. The macOS Installer opens and walks you through a few screens, showing what will be set up and asking you to continue, then requests your administrator password before finishing the job. That is all most people ever need. If you manage several Macs or want to automate the process, you can instead run it from Terminal with the installer command, pointing it at the package and a target drive. Either way the software ends up installed and ready to use once the process completes.
They are two different ways to deliver Mac software. A PKG runs the macOS Installer, which follows built-in scripts to place files and set things up for you, so it suits programs that need real setup steps. A DMG is a disk image that appears as a virtual disk when opened, and you install the app simply by dragging it into your Applications folder, with no wizard. So a PKG does the setup itself while a DMG lets you place the app by hand. Developers choose a DMG for simple drag-across apps and a PKG when installation is more involved.
You cannot install a macOS PKG on Windows, since it is built to be processed by the macOS Installer and only works on a Mac. You can, however, look inside one on Windows, because a PKG is really an archive, so a tool such as 7-Zip can open it and show the files it contains. That is handy for checking what is in a package, but it will not let you run the software. If you need the program on Windows, the usual answer is to find that app's own Windows installer, typically an MSI or EXE, on the developer's website.
Yes. Once the installation has finished and the program is working, the PKG has done its job and you can safely move it to the Trash. The installed software lives in its own place on your Mac and does not need the package any more. The only reason to keep a PKG is if you might want to reinstall the same version later without downloading it again, or if you are deploying it to other machines. For a one-off install on your own Mac, deleting it afterwards simply frees up the space it took in your Downloads folder.
No, they only share the extension. A Mac PKG is a software installer processed by the macOS Installer, while a PlayStation PKG is content downloaded from the PlayStation Store, such as a game or add-on, in Sony's own encrypted form meant for a console rather than a computer. A PlayStation PKG often needs an accompanying licence file and will not do anything useful on a Mac or PC. This is why it helps to know where a .pkg came from, since the source tells you whether you are dealing with a Mac installer, console content or a Unix package.
That message comes from macOS security, called Gatekeeper. It expects a downloaded package to be signed by an identified developer and notarized by Apple, which is Apple's malware scan, and when a package is missing either, it gets blocked with that warning. It does not mean the package is definitely harmful, only that macOS cannot vouch for it. If you trust where the file came from, you can allow it by opening the Privacy and Security settings and choosing to open it anyway, or by right-clicking the file in Finder and picking Open. Only do this for software from a source you are confident about.
There is no single undo button, because a package installs software without leaving its own uninstaller. If the package simply placed an app in the Applications folder, dragging that app to the Trash removes it. For packages that put pieces into system folders, macOS keeps a record called a receipt, and the pkgutil tool can list what was installed and where, after which you can remove those files and clear the receipt with pkgutil forget. Since tracing every file by hand is error-prone, many people use a dedicated uninstaller app that reads the same receipts and cleans everything up for them.
It depends on the package, since the install scripts inside decide where each part goes. A simple package places an app in the Applications folder, while a more complex one may add supporting pieces to system locations such as library or preference folders. To see exactly what a given package put on your Mac, the pkgutil tool can list the files recorded against it, drawing on the receipt macOS saves for every install. That receipt is why the system can later tell what a package placed, and it is the starting point if you ever need to track down or remove those files.
They are the same idea on two different systems. A PKG is the macOS installer package, run by the macOS Installer, and an MSI is the Windows installer package, run by the Windows Installer service. Both wrap a program together with its setup instructions, both give a guided install and both suit administrators deploying software widely. The difference is the platform, since a PKG is a XAR archive that works only on macOS and an MSI uses its own format that works only on Windows, so one will not install on the other. Software offered for both simply ships as a PKG for Mac and an MSI or EXE for Windows.
It is about how the package is built. An older bundle package is built as a directory that the Finder presents as one item, which is why right-clicking it and choosing Show Package Contents opens it up for you to browse. A modern flat package is a genuine single file, which is more convenient to download and sign, but it does not offer that Show Package Contents option. To look inside a flat package you use the pkgutil tool to expand it into a folder, or an archive utility that understands its XAR format. Most packages you meet today are flat, which is why Show Package Contents often is not available.
Developers build them with Apple's own command-line tools, chiefly pkgbuild, which turns a compiled app and its files into a package, and productbuild, which wraps one or more packages into a polished installer with a licence screen and layout. As part of that process the package is usually signed with a Developer ID certificate and sent to Apple for notarization, so it installs cleanly on other Macs without tripping the security warning. Graphical packaging tools exist too, but underneath they lean on the same building blocks, producing the XAR archive of payload, scripts and metadata that macOS knows how to install.
Key Takeaways
On a Mac, a PKG file is an installer package that bundles a program with the scripts and details the macOS Installer needs, and double-clicking it runs a guided setup.
It is the Apple counterpart to a Windows MSI, and under the hood it is a XAR archive you can inspect with pkgutil or an archive tool without installing.
A PKG installs on macOS only, differs from a drag-to-Applications DMG, and shares its extension with unrelated PlayStation and Unix package files, so the source tells you which kind you have.