Install a package .pkg into a custom directory

Try unpkg. It has worked flawlessly for me for several years.

unpkg solves the problem of installing a .pkg outside its intended location. You still have to figure out how to run gcc from that location. I assume it's a matter of setting the correct environment variables or setting symbolic links in /usr/local .


You cannot redirect the target on this package. Per the installer manpage the target is a device node entry such as /dev/disk*, disk ID disk1s9, a volume mount point /Volumes/Untitled, or a volume UUID. When I tried to change the target it wouldn't allow it to be changed.

The gcc3.3.pkg is a standard Apple Pkg format so right-click and Show Package Contents. Then all you have to do is "tar zxvf Archive.pax.gz" somewhere and Bob's Your Uncle. There are the files you want.

You could then repackage it how you wish for future use or you can just copy the files where you want them and try that.