Packaging OSX Applications Part 1
03/09/06 17:32 |
Work
Something new is coming soon from Wired Up and Fired
Up Ltd and I’ve been looking at packaging recently.
There are two popular options for packaging an OS X application namely, a zipped package (.pkg) file or the zipped drive image (.dmg) and choosing one is really down to the type of application you are planning to unleash.
Ninjar, for example, uses a packaged install. This is because it’s a Spotlight plugin and needs installing somewhere off the beaten track that you probably don’t want to explain to most users. It also kicks off a spotlight re-index of the disk on install, again something that a managed install can do neatly without bothering anyone.
Most simple applications however, are better served by distributing them as a zipped drive image. You know the routine - image mounts, drag the new app to the /Applications folder and trash the image. Sorted!
So how do you go about creating the .dmg and putting your app into it? And how about getting a funky background image in there as well, like they do in that fancy Adium?
Well, I’ve put together a packaging script that simplifies this process to:
1. Run script to create a temporary .dmg of a specified size and name
2. Mount the .dmg and copy your application (and any supporting files) into it
3. Unmount the application
4. Run the script again to finalize the .dmg and zip it up ready to distribute
So, how does this work?
Firstly download package.sh
1. Copy it to somewhere into your home folder (easiest as you have full permissions there).
2. Launch Terminal.app from /Applications/Utilities
3. Change directory (‘cd’) to wherever you copied the packaging script and give it execute permissions i.e.
chmod +x package.sh
4. Run the script to create a temporary .dmg of a specified size, e.g.
./package.sh -a AppName -m 2
5. This will have created an image called AppName-temp.dmg roughly 2Mb in size.
6. In the Finder, navigate to the AppName-temp.dmg and mount it by opening it, it should mount on your desktop with the name ‘AppName’
7. Drag your application (and anything else) into the AppName drive on your desktop. When you are finished eject the drive by dragging it into the trash.
8. Back in Terminal.app run the script again to finalize and zip your image, e.g.
./package.sh -a AppName -f
Er, that’s it! You should now have an AppName.dmg.zip to distribute.
I’ve been using this script to help bundle up the beta versions of ‘the new thing’ and it seems to be working well. Feel free to distribute the script, add to it or mail me with suggestions. It is distributed under a Creative Commons Attribution license.
As for the funky background image, I’ll cover that in a later post....
There are two popular options for packaging an OS X application namely, a zipped package (.pkg) file or the zipped drive image (.dmg) and choosing one is really down to the type of application you are planning to unleash.
Ninjar, for example, uses a packaged install. This is because it’s a Spotlight plugin and needs installing somewhere off the beaten track that you probably don’t want to explain to most users. It also kicks off a spotlight re-index of the disk on install, again something that a managed install can do neatly without bothering anyone.
Most simple applications however, are better served by distributing them as a zipped drive image. You know the routine - image mounts, drag the new app to the /Applications folder and trash the image. Sorted!
So how do you go about creating the .dmg and putting your app into it? And how about getting a funky background image in there as well, like they do in that fancy Adium?
Well, I’ve put together a packaging script that simplifies this process to:
1. Run script to create a temporary .dmg of a specified size and name
2. Mount the .dmg and copy your application (and any supporting files) into it
3. Unmount the application
4. Run the script again to finalize the .dmg and zip it up ready to distribute
So, how does this work?
Firstly download package.sh
1. Copy it to somewhere into your home folder (easiest as you have full permissions there).
2. Launch Terminal.app from /Applications/Utilities
3. Change directory (‘cd’) to wherever you copied the packaging script and give it execute permissions i.e.
chmod +x package.sh
4. Run the script to create a temporary .dmg of a specified size, e.g.
./package.sh -a AppName -m 2
5. This will have created an image called AppName-temp.dmg roughly 2Mb in size.
6. In the Finder, navigate to the AppName-temp.dmg and mount it by opening it, it should mount on your desktop with the name ‘AppName’
7. Drag your application (and anything else) into the AppName drive on your desktop. When you are finished eject the drive by dragging it into the trash.
8. Back in Terminal.app run the script again to finalize and zip your image, e.g.
./package.sh -a AppName -f
Er, that’s it! You should now have an AppName.dmg.zip to distribute.
I’ve been using this script to help bundle up the beta versions of ‘the new thing’ and it seems to be working well. Feel free to distribute the script, add to it or mail me with suggestions. It is distributed under a Creative Commons Attribution license.
As for the funky background image, I’ll cover that in a later post....
|