Finnian's blog

Software Engineer based in New Zealand

4-Minute Read

I recently had to create an installer for an AppleScript app (I know but I couldn’t be bothered to learn Swift and the craziness of Xcode) and it drove me round the twist looking for a decent tutorial that I could understand so that I could create my installer.

This post is primarily a reference for me but as it will need to be pretty basic for me to understand, maybe someone else will be able to follow it too.

To start with, you have to create a folder to house your application, resources and other things that need to be included on the installer disk.

I named mine OS X Installer.

Into this folder you will need to copy everything that you want to be included on the disk image. This will include the application itself and a background folder as the two essentials.

To create the DMG itself, you need to open up Disk Utility from Utilities and create a new image with all the default options and just change the Save As, Name and Where attributes and make sure it’s big enough to contain everything you want!

Now in the window that opens (or otherwise select the new device in the Finder sidebar) create a new folder called background. Into this folder you need to copy your background PNG image - the name of it doesn’t matter.

You will now need to rename the folder called background to .background (notice the leading full stop). This may need to be done with Terminal if you have not allowed Finder to see hidden files. If you do need to use Terminal, the command is

mv /Volumes/OS X Installer/background /Volumes/OS X Installer/.background

Once your background folder is all set up and contains your background image you need to disable all toolbars and sidebars in the Finder window, this is so that the installer will open without any clutter on it. To do this you need to go to View and hide the sidebar and the toolbar.

Next you need to view the contents of the installer as icons so again go to View and select as Icons. You will also need to make sure it’s not sorting the contents too by going to View and selecting Arrange By and None.

Now you need to press CMD + J and make sure the background is set to Picture.

Then press SHIFT + CMD + G to open a dialogue and type in .background and press return. Got that? Good. Now for the complicated bit.

Go back to the installer Finder window and drag the background PNG from the second Finder window to the background drop space on the View Options pane. Next create a shortcut to the Applications folder on your Mac and move that shortcut into the installer and rename it to Applications.

Now it’s time to align your icons so they fit with your background image. Firstly you should resize the installer window so that it’s the same size as the background image.

Now align your icons in the window. This should be pretty easy as you can just drag them around until they fit correctly. If you can’t seem to move them then make sure they aren’t being sorted in the View Options pane and aren’t being arranged in the View menu item.

Once your installer window is looking good you need to eject it. The easiest way to do that is to press CMD + E. Next go to Disk Utility and select your installer and press the Convert button at the top of the window. Choose compressed in Image Format. Make sure to name it something different to the original one so that you can use the old one as a template in case anything goes wrong or you need to update your installer.

That’s it! Now you can share the new DMG with other people and when they double click it they will be able install your application!

Recent Posts