Tuesday, April 15, 2008

Main Script Execution Failed (Yipe!)

While I was trying to install new apps, I started getting the message "Main Script Execution Failed!" This means that the installation script died somewhere, of course, but where? and why?

Well, a Google search told me that it's actually due to a little-known gotcha in the iPhone version of OS X.

OS X is based on BSD Unix, and like all other versions of Unix, it maps path trees to "disks" and partitions on disks. This is different from Windows (which derives much of its file system from DOS), in which each partition becomes a separate volume with its own root and path tree that has access to all the free space on the volume.

The UNIX architecture is a lot more flexible, but it can result in having directory trees mapping to different disks. For example, I can force /user/jmalin and /user/someuser to reside on different devices, if I want.

This is what iPhone does; it reserves a small "volume" for the OS files, and gives the rest to "user" files. The problem is that apps are installed by default to the OS file volume! You will soon run out of space on that volume if you install apps to a jailbroken phone.

The solution is to use a utility to move your apps to the "user" volume. The best one I've found is BossTool. Install it, run it, and ask it to move applications. It does the rest. The Main Script Execution Failed error is a thing of the past.