macos-catalinapkgbuild

macOS Catalina: trying to install content to the system volume


I have apps that I distribute as .pkg files created using pkgbuild and productbuild. With macOS Catalina, this doesn't work any more. The installer complains that I'm trying to install content to the system volume.

I posted three weeks ago thinking the error had to do with bundling a Java runtime. It turns out it has nothing to do with Java.

To test it I have the smallest possible project called Hello with a main window and a button to click. In XCode, I do Product -> Archive, then Distribute App, and Copy App. This creates a directory Hello 2019-12-18 15-01-07 with contents Hello.app. The app works fine. I then pkgbuild --root *7 Hello.pkg which creates Hello.pkg.

When I double-click Hello.pkg in the finder the installer presents me with screens for Introduction, Destination Select (only one option is offered), and Installation type ("Standard Install on Macintosh HD"), then asks me for my password. It then says, "This package is incompatible with this version of macOS. The package is trying to install content to the system volume. Contact the software manufacturer for assistance."

It makes no difference if I codesign and notarize. Productbuild only adds one more layer to the failing process.

What am I missing?


Solution

  • We could fix the issue by using the option

    --install-location
    

    of the pkgbuild command.

    If the

    --install-location
    

    option is not used, pkgbuild uses / as the default install location in many cases.

    In macOS Catalina, only certain folders are writable. Refer this link for more details.

    In our case, the package installation succeeded only when we specified one of the writable folders such as

    /usr/local
    /opt
    /Applications
    

    as the default install location.