Installation Failed message when installing PhoneGap 1.4.1 for iOS


I ran into an issue installing PhoneGap this evening. Here are the symptoms:

  • Installer never prompts for my User credentials
  • Install fails with the message:

    The installation failed.
    The installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.

 

Note: While I love how spacious Apple Trackpads are, I HATE the new gesture system. I just lost 20 minutes work writing this article because Safari thought I wanted to go back a page by swiping... wow, that was annoying.

Update: Apparently another root cause is if you have cocos2d installed. See this thread for details.

Here is what the error screen looked like to me:

PhoneGapInstallFails.png

 

When I selected Window -> Installer Log, the following message jumped out at me:

Feb 22 21:08:39 fusion installd[392]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=120 "An unexpected error occurred while moving files to the final destination." UserInfo=0x7faffbe53410 {NSLocalizedDescription=An unexpected error occurred while moving files to the final destination., arguments=(
"-f",
"-s",
"/var/folders/4k/9f8wqqkj5mv607gjqqzd6np00000gn/Cleanup At Startup/PKInstallSandbox-tmp/Root",
"/Users/rion"
), NSUnderlyingError=0x7faffbe3c6a0 "The operation couldn’t be completed. Permission denied"} {
NSLocalizedDescription = "An unexpected error occurred while moving files to the final destination.";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=13 \"The operation couldn\U2019t be completed. Permission denied\"";
arguments = (
"-f",
"-s",
"/var/folders/4k/9f8wqqkj5mv607gjqqzd6np00000gn/Cleanup At Startup/PKInstallSandbox-tmp/Root",
"/Users/rion"
);
}

 

From the above message I can tell that the installer lacked sufficient privileges / permissions to install the PhoneGap components

 

Here is what I did to work around the problem:

  1. Open Terminal.app (Found in /Applications/Utilities)
  2. Run the following command:

    sudo Installer -pkg /Volumes/PhoneGap-1.4.1/PhoneGap-1.4.1.pkg -target /

    Note: the path to your PhoneGap package file may be different. I dragged & dropped the pkg file onto the terminal window from the DMG in this example. 

    A couple of notes about the command:
    1. The sudo command lets you run a process with a more elevated permission set. (Use with caution!)
    2. The -pkg switch lets you pick which package you want to install 
    3. The -target switch lets you pick which disk drive to install the package to. '/' worked for me since I only have one drive, and that's where XCode is installed.

 

Here is the CLI output I saw when the command ran:

Installer: Package name is PhoneGap
Installer: Installing at base path /
Installer: The install was successful.

 

After installation, I was able to pick a PhoneGap project in XCode:

PhoneGapOptionInXCode.png