Forrest logo
back to the pkgutil tool

pkgutil:tldr:22ae1

pkgutil: Extract the contents of a package file into a directory.
$ pkgutil --expand-full ${filenamename-pkg} ${path-to-directory}
try on your machine

The command "pkgutil --expand-full ${filenamename-pkg} ${path-to-directory}" is used to expand a package file (.pkg) and extract its contents into a specified directory.

Here's a breakdown of the command:

  • "pkgutil": This is the command-line utility in macOS that handles packages.
  • "--expand-full": This flag tells pkgutil to fully expand the package with all its files and subdirectories.
  • "${filenamename-pkg}": This is a placeholder for the name of the package file you want to expand. You need to replace it with the actual filename of the .pkg file.
  • "${path-to-directory}": This is a placeholder for the path to the directory where you want to extract the contents of the package. You need to replace it with the actual path to the desired directory.

To use the command, you would replace "${filenamename-pkg}" with the filename of the package you want to expand (e.g., package.pkg) and "${path-to-directory}" with the actual path of the target directory where you want the contents to be extracted to (e.g., /path/to/directory/).

For example, if you have a package called "example.pkg" and you want to extract its contents to the directory "/Users/username/Documents", the command would be:

pkgutil --expand-full example.pkg /Users/username/Documents

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pkgutil tool