Category Archives: howto

Running mpkg and pkg installers on Mac OS X if the packages are intended for previous OS versions

Today I tried to build OpenJDK 8u40 image on El Capitan (MacOS X 10.11). Actually, it was a rather challenging task even with Yosemite (Mac OS X 10.10). To begin with I disabled System Integrity Protection. But after that I faced with Command Line Tools for Xcode. You need CLT with gcc to build OpenJDK. There are versions for Mountain Lion (Mac OS X 10.9) and Yosemite (Mac OS X 10.10). When I run the installer (mpkg file) I got the next message “This package can only be installed on OS X 10.8″.

This package can only be installed on OS X 10.8
This package can only be installed on OS X 10.8

To solve the issue I executed the next commands:

1. Get to a temporary dir
> cd /tmp

2. Unpack pkg somewhere
> pkgutil --expand /Volumes/Command\ Line\ Developer\ Tools/Command\ Line\ Tools\ \(OS\ X\ 10.10\).pkg ./clt

3. This step is not so easy. I opened a file inside the expanded package
>vim clt/Distribution
Surprisingly, it was a plist (a special XML-base format for storing properties on Mac)

4. Inside the plist was a tag with Java Script code! Where happened different checks of os version and paths. I substituted 10.10 to 10.11 and 10.11 to 10.12

5. I have packed the package again.
> pkgutil --flatten clt clt.mpkg
After these steps the bundle was installed smoothly.