Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically add application icon to dock on install

Tags:

package

macos

dmg

I would like my application to be automatically added to the dock after the package (DMG) is installed?

Does anyone know how to do this?

like image 366
andrewmore Avatar asked Nov 19 '12 09:11

andrewmore


1 Answers

There's a couple ways to do this, Andrew, and a lot of this depends on how you're doing your application installing.

If you are using PackageMaker to install your app, you can run a "postflight" script which adds your app's icon to the "defaults" (i.e. the preferences) of the dock. This older MacRumors thread shows how to do that.

If you are not using PackageMaker, then you might have to run an Applescript from within your app that does the same "defaults" writing trick. Here's a thread on AskDifferent that shows how.

In both cases you need to kill the dock (or Finder?) and restart it in order to get the change to pick up and show.

like image 165
Michael Dautermann Avatar answered Nov 07 '22 02:11

Michael Dautermann