Monthly Archives: September 2009

iPhone SDK on a Mac G4 without a intel based CPU.

So,

last weekend i spent about 2 hours watching the “getting started” videos on how to use the apple iPhone SDK. I proceeded to try to download the iPhone SDK but to my disappointment this is only possible if you have Mac OS X. I currently use a Core 2 DUO with 2 GB RAM running Windows 7; whereas my laptop is a Core2duo with 3GB RAM running Vista. I didn’t fancy dual booting with a dodgy copy and hacked version of Mac OS X

The idea was to create an application for the company I work for; so during the week my boss found me a spare Mac Mini PowerPC G4. It’s been laying around on a desk collecting dust for god knows how long. So last night I fetched it home…(my first mac, EVER!)

After upgrading from Panther to Leopard 10.5; I upgraded to 10.5.8 and downloaded the 2GB iPhone SDK (bundled with the latest verison of xcode) from the Apple site. I proceeded to open the installation only to discover that whilst I can install xcode the iPhone SDK option is only available if you have an Intel-based Mac. This was rather infuriating! Anyway; long story short – I Googled until I was highly delighted with finding the following site:

How to run iPhone SDK on a non intel based Mac (G4, G5 etc)

At the above URL. there are instructions on how to get xcode to let you build an iPhone app on a non-intel based Mac. Just in case the link doesnt work , I have pasted the post here:

Officially the iPhone SDK requires an Intel Mac with OSX 10.5. Since I have a four year old dual G5, which is still running like a young dear, I don’t want to buy a new Mac just for writing iPhone Applications.

After some research, I found out, that it’s possible to make it work on PPC since the iPhone SDK are universal binaries.

To share my knowledge, I write a small tutorial. Note, that I don’t take responsibility, for any defects cause somebody used my code!

How to get the iPhone SDK to work on PPC Macs

Most of the tutorials I found in the Web are not up to date, because there where no “Aspen” packages anymore. With the iPhone SDK for IPhone OS 2.1 (build 9M2517) you can follow these steps:
1. Download the official iPhone SDK here.

2. Mount the .dmg image and install the iPhone SDK (the iPhone SDK will be grayed out!).

3. After rebooting the Mac, mount the image again and go to the folder Package. Install all packages which have iphone in the name (e.g. Simulator, SDK, Documentation).

4. Go to the folder /Platforms on the local HD and copy the iPhone.platform and theiPhoneSimulator.platform folders to /Developer/Platform.
Don’t copy the whole platforms folder, Xcode will not run correctly anymore!

5. Now we come to the interesting part. Xcode has now access to the iPhone SDK, you can already create iPhone projects, but Xcode still wants to compile the sources for the Intel architecture. To change that, open the folder /Developer/Platforms/iPhoneSimulator.platform/Developer/
Library/Xcode/Specifications/
.
In this folder you will find the file iPhone Simulator Architectures.xcspec. Make a backup and open it in any text editor. The content should look something like this:

(
// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386);
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";
},

// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";
},

// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;
},
)

6. Change the line “RealArchitectures = ( i386);” to “RealArchitectures = ( i386, ppc);“.

7. Add the architecture configuration for G3, G4 an G5, the edited file should now look like this.

(
// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386, ppc)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386, ppc7400 );
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";
},

// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";
},

// G3
{ Type = Architecture;
Identifier = ppc;
Name = "Minimal (32-bit PowerPC only)";
Description = "32-bit PowerPC ";
PerArchBuildSettingName = "PowerPC";
ByteOrder = big;
ListInEnum = No;
SortNumber = 201;
},

// G4
{ Type = Architecture;
Identifier = ppc7400;
Name = "PowerPC G4";
Description = "32-bit PowerPC for G4 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 202;
},

// G5 32-bit
{ Type = Architecture;
Identifier = ppc970;
Name = "PowerPC G5 32-bit";
Description = "32-bit PowerPC for G5 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 203;
},

// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;
},
)

Now you should be able to compile the iPhone project and run the app in the iPhoneSimulator. I never tried to put an App into the AppStore, but I think it should work.

So – if you follow those instructions (like I did) then you should be able to open xcode and build an iPhone app!

Worked a treat for me!

Share