Using the iPhoneOS SDK on older PPC Macs

(Please note, because of the time that has passed since I wrote this article, it may no longer reflect my current views or the most accurate and complete information available on this subject.)

I'm just getting started with developing applications for the iPhone / iPod Touch, and one of the first real hurdles I encountered was that Apple didn't make it easy by default to use their iPhoneOS SDK on non-Intel Macs. With some Googling around I was was able to find a variety of articles that mentioned workarounds, but the comprehensive solution was spread across lots of blog post comments, forum postings, etc. So, for my own reference and hopefully as assistance to anyone else who might be in the same boat, I'm consolidating the steps here.

I'm using a 1.5GHz Powerbook G4, which uses the PowerPC (PPC) architecture. I downloaded version 2.2 of the iPhoneOS SDK, build 9m2621-final.

After the regular installation of the iPhoneOS SDK (which is really just the regular Xcode install with some additional packages thrown in) was complete, the Xcode new project menu was notably missing the option to choose the iPhone platform. On the advice of this 3by9 article, I took these steps:

  1. Mount the SDK installer disk image
  2. Open the packages folder
  3. One at a time, install all of the .pkg files that begin with "iPhone", using the default install destination
  4. When done, you'll have a "Platforms" directory in the root level of your Mac's hard drive. Move the contents of that directory into the /Developer/Platforms/ directory. If you're like me, when you're done, you'll have three directories in /Developer/Platforms: "iPhoneOS.platform", "iPhoneSimulator.platform" and "MacOSX.platform".

Once that step is done, you'll be able to launch Xcode and create new projects that use the iPhoneOS platform and application types. But, you still won't be able to build or run those applications, because Apple has hardcoded the "i386" (Intel) architecture as the only valid one to compile for. Thanks to a variety of comments on the above 3by9 post and comments 23-25 on this TUAW article, here are the remaining steps to address that:

  • Close Xcode and edit this file (perhaps after making a backup): /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec
  • Change line 12 to read Name = "Standard (iPhone Simulator: i386 ppc)";
  • Change line 16 to read RealArchitectures = ( i386, ppc );
  • Add this chunk before the last closing parentheses:
         // PowerPC
         { 
              Type = Architecture;
              Identifier = ppc;
              Name = "PowerPC";
              Description = "32-bit PowerPC";
              PerArchBuildSettingName = "PowerPC";
              ByteOrder = big;
              ListInEnum = NO;
              SortNumber = 106;
         },
    
  • Save the file and close it. Now relaunch Xcode.
  • With Xcode open and your project loaded, right click on the project name under the "Groups & Files", and select "Get Info"
  • Under the "Build" tab and in the "Architectures" menu, change these options:
    Set Architectures to "Native Architecture of Build Machine"
    Set Base SDK to "Simulator - iPhoneOS 2.2"
    Leave Build Active Architecture Only checked
    Edit Valid Architectures to be not only include armv6, but also "ppc" and "i386".
    (I think some of these may be redundant, but it's the combination that's working for me.)

When you next build your project, you shouldn't get any errors about VALID_ARCHS.

I hope that's helpful. Since this is only one particular combination of build hardware/architecture and SDK software version, I'm sure there are other combinations out there where the above may not work, your mileage may vary.

Now, back to working on building an actual application...

19 thoughts on “Using the iPhoneOS SDK on older PPC Macs

  1. So how well is it working for you on PPC? Which version of OS X? I am getting the new OS X bundle at the end of the month, and I am running PPC, and I would like to port some of my games over to the iphone/ipod touch.... Let me know how well it works and if you can get the applications to run sucessfully on the iphone/ipod touch. Cheers!

  2. Thanks a lot. It was very useful.
    In fact, it is working very well now.
    I have the same machine than your. Now, I have to learn how to develop in this platform.

  3. I followed the instructions to the letter and cannot run xcode. I'm running a Dual G5 with OS X 10.5.6 and iPhone SDK 2.2.
    I get the message below when trying to run xcode:
    ***********
    File: /SourceCache/DevToolsBase/DevToolsBase-1148/pbxcore/SpecificationTypes/XCPlatformSpecification.m
    Line: 424
    Object:
    Method: loadAllPlatforms
    The Mac OS X platform is missing - cannot set a default platform.

  4. If I move the platforms directory BACK to just /Platforms I CAN run xcode with NO errors. However, when I try and build the example "MoveMe" application written by apple, I get :
    ***********
    Line Location MoveMeView.xib:0: Command /usr/bin/ibtool failed with exit code 1
    Line Location MoveMeView.xib:0: Description: ibtool failed with exception: IB requires the Cocoa plug-in

    *******

  5. Hey Guys, I can assure this is the ONLY working procedure!!! I tested a lot of other procedures described on the net (Pacifist,ecc) and this one rocks!!!It works perfectly for iPhone SDK 2.2.1 on an ibook G4 1.42 Ghz with Leopard (10.5.6)....Thank you Chris....you are the Man!!

  6. Wow Chris you saved me $ 600... I allmost thought I had to buy an intel mac. Considered I had allready bought Leopard to upgrade my Imac G4 "17 PPC. Think it is not like apple at all to do this... Thanx man.

    Andy.

  7. Hi Chris,

    Did you ever get an aplication on your Iphone ? I have done everything... registered, so I have all certificates but it keeps giving me an error. I read this is a well known problem but I wondered if you might have tackeled it. Seems to be a problem to be solved with codesign.orig But I don't have any knowledge on compiling files, etc. So far I can only test in emulator and not on my phone. I have SDK 2.2.1 and Iphone software is the same I believe...

    Thanx,

    Andy.

  8. Hi Chris,

    Nice article! Worked perfectly fine, until I've encountered a bump regarding the iPhoneSimulatorArchitectures.xspec. It seems that in my case, I replaced:

    /Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec

    and NOT

    /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec

    (I got the tip from Spiced Ham's comment, comment # 23
    http://www.tuaw.com/2008/03/27/iphone-sdk-beta-2-now-hitting-the-streets/2#comments
    )

    Add ppc to RealArchitectures in:

    /Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator Architectures.xcspec

    Note: is not /Developer, then you need to make a link from /Developer/Platforms to /Platforms, as the WebKit framework used by the iPhone simulator expects to find CoreGraphics under /Developer/Platforms. If you don't do this, the simulator will fail to run.

  9. Excellent comprehensive solution! The only thing I had to change was the default location for the all the iPhone*.pkg installations to /Developer otherwise it will just plonk them into /

    If your default was /, then just move the directory to /Developer or wherever you installed Xcode. Works fine after doing this so far.

    Thanks again!

  10. Thank you so very much, took me about 6 hours googling, and another 3 of installing and re-installing, but following your guide I finally got the simulator to pop up. Even better no more of those error buttons popping up on the bottom right! Thanks again, this is the best guide to getting ppc to work.

  11. Thanks for the instructions, they work like a champ for the 2.2.1 SDK.

    One missing step is on #3 when installing anything that begins with iPhone* also make sure you install the DeveloperDiskImage.pkg if you want to run your apps on a "real" device, not just the simulator.

    Also, one sad note. It appears that with the upcoming iPhone OS 3 Apple has decided to make the Simulator an Intel ONLY binary... meaning, the simulator won't even launch on PPC based Macs 🙁

  12. I also get the same error on my PowerBook G4 as Dan:

    Description: ibtool failed with exception: IB requires the Cocoa plug-in

    please help!

  13. @Dan and Tom: did you follow the advice to move the _content_ of /Platforms to /Developer/Platforms not the folder itself. So in /Developer/Platform there must be still the MacOSX.platform?

    But I've still the problem to install the apps over the organizer to the iPhone. Any Codesigning issues I foreclose because I can install the apps with iTunes and they run! But for Debugging I've no chance. Any time I tried I got 'unexpected Error (E8000001)' (without any comment) and I think before any transmission to the iPhone. There are no messages about this in the Console.
    I hoped withe Jasons Tip I get further, but nothing changed. 🙁

    BTW: @Andy: the codesigning problem is solved with 10.5.7!
    So can anyone help me?
    I've G5 Quad with 10.5.7 and SDK 2.2.1 and iPhone classic
    Thanx
    chappell

  14. i don't suppose anyone has the 2.2 sdk that i can get a copy of. i downloaded 3.0 & have followed all the instructions correctly on modifying options but i still get error msgs on build. if anyone could help me out, that would be awesome.

    thx!

  15. Chris,
    Thanks everso much for all this info. I'm running Mac G5, Leopard OSX.10.5.8 and have just downloaded SDK 3.1.4. Having tremendous problems getting Xcode to work. Have managed to get the Xcode to launch and the iPhone OS Option in new project window all fine. Thanks for your blog and 3by9, I have altered the Architecture and xspec doc correctly. Manually installed relevant iPhone packages to the Developer folder, but still am unable to launch iPhone Simulator when I do Build and Go.

    I get Error on line 88 when I launch Xcode and build and go brings up iPhone Developer doesn't match any valid certificate/private key pair in the default keychain. Also the iPhoneSimulator.app is unable to launch individually as it has a "no entry" symbol on it.

    Have restarted computer.

    Stumped again.

    Any suggestions welcome.

  16. Hi, these instructions dont seem compatible with SDK 3.0 onwards? Has anyone got a copy of the 2.1 installer? It seems as though Apple have removed all links to download it.

  17. Chris, this article is very helpful and I know I dating myself but for the life if me I cannot find those iPhone packages (for the platforms) in the Xcode download of 3.1.3. I think I need iOS 2.2 but ADC no longer carries the link. Any ideas or maybe just better to upgrade. I still luv my PPC though. It's a champion!

Leave a Reply

Your email address will not be published. Required fields are marked *