I have a binary file, foo.
I would like to bundle this in an installer for mac; A .pkg installer file.
It should install the binary in /usr/local/bin/mybinary.
Attempt:
$ cd Desktop // <--- foo binary is here
$ pkgbuild --identifier com.foo.pkg --install-location ./usr/local/bin/ --root ./ foo.pkg
This creates a .pkg file: foo.pkg on my desktop. And when i run foo.pkg, it installs the foo binary in /usr/local/bin correctly, except that it also leaves foo.pkg in /usr/local/bin also.
How can make pkgbuild avoid leaving foo.pkg inside /usr/local/bin?
When you supply the --root argument, you’re supposed to pass a directory of everything you plan to install. Passing in . in this case is bad because that’s your desktop. So, when pkgbuild starts up it creates the output foo.pkg on your desktop and then, later on, it sees that foo.pkg is part of your root and includes it in the installer.
To fix this, put your tool into its own directory and pass that in via --root.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"