6th August 2015 | By: marcinkawa
Mac Installer adding app to the dock
Installing applications on Mac is a very simple task, all you have to do is drag and drop your application in a special folder named “Applications”, this tutorial will help you to create an installer for your application and the automation of adding to the dock. Adding to the dock is a post install process and requires you running a special script which adds your program to the dock.
There are number of tools on Mac which allow the creation of installers, most of them also to run post/pre install scripts, these are:
The following tutorial will use the Packages tool, the main reason being for it’s simplicity. The full tutorial and how to use ‘Packages’ can be found here, we are only interested in the post script section for this tutorial.
Once you have your application packaged and it is ready to be deployed we now need to configure “Packages” to run the post script which will setup the application in the dock, the tool we use is called Emmet. Emmet is a simple application with a sole purpose of adding your application to the dock.
You can use Emmet #from command line with the following format
./emmett add path_to_our/project.app
Now we need to add the application to the ‘Packages’ project. Let’s use ‘Google Chrome’ as our application as an example.
Next set up a post installation script. After the installation the location of newly installed app is sent to the script as an argument so even if the user will choose different location than standard one, it won’t cause any problems.
# We only install the application in the Dock for the current user and when the installation is not run from the command line.
if [ "$COMMAND_LINE_INSTALL" = "" ]; then
/usr/bin/su $USER -c "./emmett add \"$2\""
Now let’s select the app (Google Chrome in our case) and setup a post install script for it, see the picture below:
The final step is to include the small executable to the project without forcing user to install it.
That’s it. At this stage you can go a head and built the installer. Now you have a Mac application installer which will setup our application in the dock bar for each user.