disable "Change Install Location..." button in installer created using productbuild
I want to disable "Change Install Location..." button (screenshot below) in installer. I am trying to create the installer using pkgbuild and productbuild on macOSX 10.8. First, I am creating two .pkg files using pkgbuild.
pkgbuild --root myApp --component-plist myApp.plist --scripts appScripts --identifier com.myapp.coreapp --version 1.0.00 --install-location /Applications --ownership preserve pkgbuild --root myBr --component-plist myBr.plist --scripts brScripts --identifier com.myapp.browser --version 1.0.00 --install-location /Library/Internet\ Plug-Ins --ownership preserve
In the above plists, I am using BundleIsRelocatable as false.
And then I am using productbuild to create the final installer package.
productbuild --distribution dist.xml --resources res inst.pkg
In the dist.xml, I have tried all combinations with domains and also rootVolumeOnly but I am still not able to disable the "Change Install Location..." button.
Can somebody please help? Thanks a lot.
I had opened a radar bug for the same and got the answer - One needs to specify only the domain required and set the rootVolumeOnly to true.
So, in my case, the following worked:
<domains enable_localSystem="true"/> <options rootVolumeOnly="true"/>
Unfortunately the "Destination Select" and the "Installation Type" are always shown by the Installer. As is the "Change Install Location..." Button.
This doesn't allow the user to change the Install Location, but UI wise it is not optimal. I can only recommend to fill a bug report against it.
You maybe wanna look into: Known Issues and Workarounds - Destination Select Pane about the usage of domains vs rootVolumeOnly
It is a quite old question, but as I just faced this problem and fixed it. None of the solution I found on the internet solved my problem, so I will post my answer for others that face this problem.
The solution is somehow weird but it works fine. All you need to do is to add an empty plugin to your installer. The following steps will guide you through:
- Create a folder named Plugins in your project, I assume the folder is beside your distribution.xml file.
- The structure of files inside Plugins folder should look like this:
as you see on top level of Plugins folder there is a folder named DisbableDestinationSelect.bundle and there is a file named InstallerSections.plist
- Under DisbableDestinationSelect.bundle you need the exact folder structure. DisbableDestinationSelect is an empty file that must be executable. Thus, if you create the file in the command line do not forget to run chmod +x DisbableDestinationSelect
- The InstallerSections.plist file should look like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>SectionOrder</key> <array> <string>DisbableDestinationSelect.bundle</string> <string>Introduction</string> <string>ReadMe</string> <string>Target</string> <string>PackageSelection</string> <string>Install</string> </array> </dict> </plist>
There you go! Now create your final product with a command like this:
productbuild --distribution distribution.xml --resources Resources/ --plugins Plugins/ --package-path ./ "$PRODUCT_NAME.pkg"
and the "Change Install Location..." button is gone forever