9

I am trying to package an application I have been working on using OSX. I have the package created and I can do some basic (check system values etc) checks.

What I now want to do is to gather end user data during the install so I can create a custom config file.

I understand I must use installer plugins to do this but I cannot find any useful information to do this.

Can people please share resources, link or useful tips to help me do this.

Matt Seymour
  • 8,880
  • 7
  • 60
  • 101
  • Can you gather this "end user data" *before* the install starts? E.G. via a pre-flight script that spits out the end-config file? Or is there something very special that you are doing that would require an installer plugin? – Michael Dautermann Mar 12 '13 at 19:11
  • I think a preflight script is what I need. Do you have any examples of this? – Matt Seymour Mar 13 '13 at 10:06
  • @MattWritesCode I am also looking for the answer, wanting the samething. Can you share me how you had done it. I am also doing it. – imp Nov 12 '13 at 06:40
  • @Dexter you will need to create a bundle within xcode. A bundle can then be bundled into your installation package. Apple has an example of this at this link https://developer.apple.com/legacy/library/samplecode/InstallerPluginSample/Listings/Registration_RegistrationPane_m.html#//apple_ref/doc/uid/DTS10003945-Registration_RegistrationPane_m-DontLinkElementID_6, like wise this question on sof may also help http://stackoverflow.com/questions/2898964/how-do-i-get-user-input-into-a-packagemaker-package finally this page also helped a lot http://s.sudre.free.fr/Software/Packages/resources.html – Matt Seymour Nov 12 '13 at 12:44
  • @MattWritesCode I seen the above link, you had shared. On Xcode project, it is showing build successful. But on repository folder which is given by us, does not contain myapp.bundle. I am not able to find bundle which is developed through xcode project. – imp Nov 12 '13 at 13:53
  • @MattWritesCode Please also see the http://stackoverflow.com/questions/19893324/how-to-pass-data-to-a-file-while-package-installation-on-mac – imp Nov 12 '13 at 13:54
  • hello i am struggling with adding images in my plugin but on the packages app my custom plugin does not show any image. any help would be appreciated – Zeeshan Suleman Nov 30 '20 at 15:08

1 Answers1

4

(Super) late answer, but am currently doing this. I'm using packages. Its a program which will build an installer for you.

What you do is supply it your.app and an installer plugin, and off you go. (You can create installer plugins in Xcode when it asks you what type of project you want to work on).

Regarding problem you are solving specifically, my solution was to get the input configs from the user from the plugin I wrote. The plugin would then write these configs to a file in a temp location. I then modified my app to look for these configs and read them from there.

Note: your plugin will not run with admin privileges (even if you ticked the box in the for this in the packages app). If you need to have admin privileges, consider adding a post-install script in packages (and make sure you enable "Require admin password for installation" in the "settings" tab)

OrangePot
  • 1,053
  • 2
  • 14
  • 38
  • May I check what is the temp directory that you are storing your configuration? The temp directory is different from in the installer plugin vs the post-install script – Buzz LIghtyear Jun 17 '19 at 02:23
  • 1
    I'm storing things in /tmp/MyApp/TempConfig.csv, beware that OSX may clear this folder, this will only work if your app only needs to read those configs once. For persistent data, you could store it in `~/Library/Application Support/` – OrangePot Jun 17 '19 at 16:00
  • Thanks, Am storing it in the ~/Library/Application Support/ directory and it works great – Buzz LIghtyear Jun 17 '19 at 22:33
  • Hi, perhaps do you know if there's a way to run those installer plugins when running the installer from command line ? also, is there any indication I can get in post install that my installer is running from GUI/non-GUI mode? – Zohar81 Jul 22 '20 at 12:37
  • Your installer shouldn't be running after the install, only your app should be. If you're on the machine, you could check the process list. If you're checking remotely it might be more challenging; you would have to check if your client has managed to establish a connection to your servers (application logic). – OrangePot Jul 22 '20 at 16:46
  • hello i am struggling with adding images in my plugin but on the packages app my custom plugin does not show any image. any help would be appreciated – Zeeshan Suleman Nov 30 '20 at 15:08
  • Images are not read from your plugin as far as I'm aware. If you want to add a logo in the installer, you should do this from the packages app. Make sure your path is correct in terms of relative/absolute/... – OrangePot Dec 01 '20 at 00:46