electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Customize installer for Mac

Open aishahsofea opened this issue 4 months ago • 3 comments

I am using electron-builder to package my electron app for Mac. I would like to allow my user to choose whether they can run the launcher app after installation is successful. Probably something like a checkbox. If it is being checked, and user click Close, the launcher will run. Is it possible at all to customize this? I can't find it anywhere in the documentation.

aishahsofea avatar Feb 20 '24 15:02 aishahsofea

Is this a .pkg target? I don't think that's possible to do so on mac, at least for .app within a .dmg since the process requires the user manually drag-dropping the .app into /Applications or other directory.

mmaietta avatar Feb 20 '24 16:02 mmaietta

@mmaietta yes, it is a .pkg target, and it does not require drag-dropping. I will need to go through these installation steps and clicking Close at the end will just close the installer. I'd like to add a checkbox at this step. Another alternative could be to automatically launch the launcher when closing the installer.

Screenshot 2024-02-21 at 12 13 06 AM

aishahsofea avatar Feb 20 '24 16:02 aishahsofea

Can you try writing a postinstall file to be included with the .pkg? I found this resource on a simple implementation https://stackoverflow.com/a/42850950

It doesn't seem possible to change the installer dialog AFAICT. (Happy to be proven wrong though 🙂 )

mmaietta avatar Feb 20 '24 16:02 mmaietta

@aishahsofea Oh, The approach suggested by mmaietta should be fine, but there is another problem. Also see #8063

KaminoRyo avatar Feb 21 '24 02:02 KaminoRyo

@mmaietta

Can you try writing a postinstall file to be included with the .pkg? I found this resource on a simple implementation https://stackoverflow.com/a/42850950

It doesn't seem possible to change the installer dialog AFAICT. (Happy to be proven wrong though 🙂 )

That works, I could automatically run the launcher post installation. But i still want to give user the choice whether to run it or not. I'm thinking that maybe it's possible to create a script inside postinstall file, where it will open a small popup window, and handles the UI & logic in this new window. @KaminoRyo do you know if this is possible?

aishahsofea avatar Feb 21 '24 05:02 aishahsofea

Sorry, but I don't know about that. After searching, I found the following articles to be helpful.

KaminoRyo avatar Feb 21 '24 07:02 KaminoRyo

@KaminoRyo that's helpful, but i'm facing another problem. Scripts inside postinstall is actually triggered during installation step. This makes user experience not smooth, because at installation step, a popup will appear that allows user to run launcher, and launcher will run. But seconds after, summary is shown saying "The installation was successful". I foresee this will create bad user experience

@mmaietta is there any alternative to postinstall that will make sure script run at summary step, or better yet, once we click on Close button.

aishahsofea avatar Feb 21 '24 15:02 aishahsofea

Well, pkg scripts only allow a pre/postinstall hook, so it makes sense that it's running as part of the "install" phase. pkg installers are purely handled by macos system, I don't think it's possible to have it run after hitting the close confirmation on the installer dialog

mmaietta avatar Feb 21 '24 16:02 mmaietta