FlamingMoe
FlamingMoe

Reputation: 2994

Packaging a Mac installer from app bundle installs the folder "Contents" in /Applications instead the bundle itself

When I try to use packaging with my .app to create a Mac installer, and I run the installer, it creates me a folder named "Contents" in my /Applications folder, instead the "bundle app" as it should.

I've test with pkgbuild + productbuild:

pkgbuild --component "./myapp.app" --version 1 --install-location /Applications component.pkg
productbuild  --package-path "component.pkg" --distribution "./Distribution.xml" --package-path "./Temp" --resources "./Resources" --sign mycert "myapp.pkg"

And just with productbuild:

productbuild --component "./myapp.app" /Applications -s mycert myapp.pkg

In both cases, I run the installer, everything seems fine, but in Applications folder I see "Contents" (that is the content of the app bundle)

I've tried with "./myapp.app/" also in --component attribute, and even adding "/Applications/myapp.app" in the --install-location

Upvotes: 4

Views: 5324

Answers (2)

Golammott
Golammott

Reputation: 536

As Vikram stated pkgbuild is not supposed to bundle the ".app", but instead looks for only the "Contents" present in that directory.

If your only goal is to change to directory where the bundle gets installed, you could specify an alternative install location.

pkgbuild --component "./myapp.app" --version 1 --install-location /Applications/myapp.app component.pkg

Upvotes: 1

Vikram Singh
Vikram Singh

Reputation: 1806

pkgbuild --component "./myapp.app" --version 1 --install-location /Applications component.pkg

With the --component flag, you are supposed to give the directory path where your bundles are present. You should not give the path upto the app bundle name. If you want to bundle the contents present in ./TestDir/myapp.app, you should provide the path as ./TestDir and everything inside the dir will be bundled.

pkgbuild --component "./TestDir" --version 1 --install-location /Applications component.pkg

Build the package Sample.pkg using the entire contents of the destination root /tmp/Sample.dst.

pkgbuild --identifier com.sample.pkg.app --root /tmp/Sample.dst Sample.pkg

Upvotes: 2

Related Questions