Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I extract the binaries out of a pkg file without adding them to the default locations under /usr or other default folder. I want to add this package under my own directory /our_own_directory/our_own_prefix_specific_for_this_package so it is self contained, easy to know what is going on, and is tied to our application directories instead of OS directories.

Also, I don't want to touch the global database of installed packages.

share|improve this question
up vote 9 down vote accepted

Though this won't install the package, you can transfer them from a package file (aka a datastream package) to a spool location with the pkgtrans command:

pkgtrans filename.pkg /home/user/temporary_package_prefix

This will extract the package file system hierarchy as well as the pkginfo file and any pre/post install scripts into your directory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.