I finally got access to a Mac which I can develop on, and after about 30 minutes of learning how to use it (I haven’t used one since grade school), it was amazing! Yes I want a Macbook now, but that’s another post. The first job for creating a dmg on a Mac using the Mozilla code, is actually getting it to run XUL apps. To do this you must first download and install XULRunner, which conviently for Mac is just a standard installer. Once installed, the XULRunner runtime is placed in:
/Library/Frameworks/XUL.framework/
This will make available ‘xulrunner-bin’, which will be needed to run the XUL app. I noticed (and liked) that the XULRunner runtime is installed in a default location similar to Linux and unlike Windows, where it is just where you put it, and you have to set a bunch of environment variable to point to it. To run a XUL app, is almost just as easy, there are two ways:
Install the application:
/Library/Frameworks/XUL.framework/xulrunner-bin –install-app /absolute/path/to/app.zipRun the application (without install):
/Library/Frameworks/XUL.framework/xulrunner-bin /absolute/path/to/application.ini
If you choose to install the application, it can be a XUL app packaged in a zip file or a folder of a XUL app, but it will conviniently put your installation into the:
/Applications/<vendor>/<appName>/
You can then run the app. If your developing, it may be a better idea to simply run the application, however there is a warning on MDC that the menu bar and dock icon may be missing. From experience, on my first run, the command executed, and I got nothing, and the bash prompt appeared, so I ran it again and I received a message that the app was already running. No window opened or anything, so I just closed the Terminal, refactored my code (I think there were some errors in it), and ran it again, with success.
Once I got my app working, running the ‘pkg-dmg‘ was simple, and it worked brilliantly! From mozilla-central, I stored only the folders leading to the ‘pkg-dmg’ file, then all the files in the folder. So basically, ‘mozilla-central/build/package/mac_osx/‘ , then all the files in /mac_osx. I made some modifications for my XRap release, by putting ‘pkg-dmg’ command in a script and calling it, but this is basically how it should work:
var getWorkingDir= Components.classes[“@mozilla.org/file/directory_service;1”] .getService(Components.interfaces.nsIProperties) .get(“CurProcD”, Components.interfaces.nsIFile);
var dmgLoc = getWorkingDir.clone();
dmgLoc.append(“mozilla-central”);
dmgLoc.append(“build”);
dmgLoc.append(“package”);
dmgLoc.append(“mac_osx”);
dmgLoc.append(“pkg-dmg”);
process.init(file);
var args = [“–source “,applicationPath ,” –target “,applicationPath + “.dmg”];
process.run(true,args,args.length);
And work it did! Here is an example, when I called it from bash
Mount and go!