So, I packaged up my native looking Mac application in my own Application Bundle. It was super simple to do.
An application bundle is nothing more than a folder that has been renamed with the extension “.app” and conforms to a certain directory structure. The directory structure looks like this:
/Contents/ /Contents/Info.plist /Contents/MacOS/ /Contents/Resources/ /Contents/youricon.icns
The important piece is Info.plist. It tells the system what to call your bundle and where the executable is located.
<plist version="1.0"> <dict> <key>CFBundleExecutable</key> <string>test.rb</string> <key>CFBundleGetInfoString</key> <string>Test</string> <key>CFBundleIconFile</key> <string>test.icns</string> <key>CFBundleIdentifier</key> <string>test</string> <key>CFBundleName</key> <string>Test Name</string> </dict> </plist>
Your application should go in MacOS. I put my ruby script in the MacOS directory and it could not longer load my resources that were right next to it in that directory. If I hard code the path to be an absolute path based on where the app is bundled (/Users/jasonxrowland/myapp.app/Contents/MacOS) it works. I have a feeling, I need to call a Mac specific API to get the resource bundle path. I’ll figure that out later…
I created the icon using the Icon Composer application included with the Mac.
Post a Comment