Developing for the iPhone and iPad by runing OS X 10.6 Snow Leopard on a PC

UPDATE 2011.07.06
ERROR: the cpu has been disabled by the guest operating system
I got this error with my new i7 2600 and the fix is to add this line to your .vmx file:
cpuid.1.eax = “0000:0000:0000:0001:0000:0110:1010:0101″

I don’t have this problem on my last gen i5 which is weird. So it must be the newer socket type / sandy bridge cpus.
OSX Lion, may not have this issue, we will see soon enough.

Developing for the iPhone and iPad by runing OS X 10.6 Snow Leopard on a PC
If your looking to get a taste of the OSX environment for what ever reason, be it iPhone or iPad development, or even if like me your a Brisbane Web Design who yearns for a unix system with photoshop out of the box and even steam game support, then there are a few options.

After all you cant compile iphone apps on PC, theres no good toolchain since firmware version 1, and unless your a pro linux hacker who writes apps for cydia chances are you dont know the first thing about GCC and tool chains. I certainly do not.

You could buy a mac, but chances are if your reading this article you dont want to.

Firstly, getting OS X

Installing OS X Snow Leopard Hackintosh Style

The best method available to date is TonyMacs iBoot.

iBoot is basically a blank CD that lets you bootstrap a retail DVD and install it hassel free.
Once installed the MultiBeast Tool from TonyMac helps you find drivers or kexts and install those.

One thing to be careful of is the use of Intel i5′s and i7′s. They werent supported by the vanilla (the unmodified apple) kernel of OSX until 10.6.3, so you may need to boot a non vanilla kernel such as Chocolate Kernel (love the humour of the programming community) and then patch to the latest version to get your hackintosh running tasty vanilla kernel on your super sweet i5.

A note on Patching, I installed the 10.6.5 patch to my VM this morning and it worked flawlessly, so its likely to be just as smooth on a hackintosh.

The Steps in Order:
1) get iBoot and burn to a CD
2) read the instructions, then read them again, if your having trouble there is probably a solution but you need to understand why its not working so you can Google the right answer :)
3) install osx
4) update osx, the latest version is 10.6.5
5) get MultiBeast and go get all the drivers you need for your hardware, you might not get everything working flawlessly
But for iPhone Development all you need really is network, keyboard and mouse and decent resolution for your monitor.
I installed it this morning 11/11/2010 and it works flawlessly
Install OSX hackintosh style, meaning its running on your PCs bare metal booting natively.
I have done this both with Tiger back in the day using old school DD images and using Snow Leopard retail images and various usb methods.

Installing OSX Vmware Workstation Style

Crysis 2 Anyone? :)

1) install vmware 7.1
2) install vmware patch for osx guest
3) install osx
4) update osx, the latest version is 10.6.5
I installed it this morning 11/11/2010 and it works flawlessly

5) Get all your drivers, this is hard part but searcing these sites is your friend

For this I would strongly recommend these resources.

This used to be a pain in the ass. Seriously, it would require using a special darwin iso which was made to allow vmware to boot a darwin environment, which is the open source tree of freebsd / nextstep, and then jump across into osx.

The reason being, Apple in their ivory tower, dont want people running OSX as a guest in a Virtual Machine.
VMWare have complied with Apples wishes and stripped from the PC version of their software the ability to run OSX as a guest.

Enter the h4x0r.

An epicly awesome coder going by Albert Nietsnie on the insanelymac forums posted this handy little fix for VMWare Workstation 7.1.

What it does is patch VMWare to re-enable the OSX Guest capability. After all the coders at VMWare obviously decided that removing all the functionality from their code base would be more time consuming than simply nerfing the final binaries.

Once patched your in VMware heaven. You can pick OSX from the install process and have your VM installing and booting in no time.
The trick to getting your VMware install working smoothly is to install a few drivers and handly little utilities.
This guy is another hero of mine. zenith432 has helped create both VMware Video drivers and sound drivers so your OSX Guest VM can operate usably.

osx drivers vmsvga2 and ensoniqaudiopci

Install both of those and reboot, also make sure you tell VMware to add a Sound Device to your guest, and change it to use default host sound card.
This allows windows 7 to pipe the sound through Windows 7s Audio Mixer so you can play it with other audio. If you were to connect say a USB headset directly to the VM, you wouldnt be able to share that with Windows, so no Winamp for you! :(

Vmware Tools and Unity

If your a VMWare Lover like me your thinking, Unity? Please? No sorry, You can install the VMWare Tools for OSX which come with VMware fusion.
Download VMWare Fusion and find the darwin.iso file and install them. They probably help something but you dont get the coolness of what VMWare tools would do if they were meant to allow OSX to run in Workstation.
No drag and drop files. No simply networking folders. And no UNITY.

Hopefully that changes in the future.

Secondly, getting your iPhone Development Environment Cranking!

5) install caffine
6) change screensaver and power options to off
This is super important, for a long time I couldnt work out why my OSX Guest VM would crash from time to time.
Turns out its a power saving option which gets enabled, and then the VMware Workstation Host environment has trouble waking the machine out of sleep, probably because theres no proper ACPI drivers.
Once Caffine is installed you can use it to ensure your machine never goes into sleep mode. Also make sure to turn off all power saving options in the Settings area of OS X.
With this I have left my VMWare Guest running overnight and through the next day and its been ready and waiting still running when I returned.

7) install iphone dev tools
Go download xcode and the dev tools and install

8) install git
You are going to want GIT for pretty much any coding, if your more comfortable with SVN nows time to switch to GIT
I found this Crash Course on GIT for SVN users to be handy when I first got into GIT.

9) get doublecommand and swap keyboard keys
This will save your life, seriously. You will have a PC keyboard and everything will be confusing.
You want these options. Which will give you control c and control v, pc style home and end keys and the usual, control t and w for opening tabs in chrome and closing windows etc.

10) Understand PhoneGap
follow setup guide

11) Follow steps to setup CSR
Utilities > Keychain Access, Create CSR, upload CSR and approve via email

12) Go through each step on the left, find your uuid for your device and add it to the devices list.
I was a little scared when I got to this step, because my iPhone is Jailbroken and I thought, hell, I dont want to “RESTORE” my iPhone into “development mode”.
You dont have to restore your iphone but just press the “use for development” button in the xcode organizer to allow developer provisioning to work.
13) Create an app, using the reverse domain name system
This was confusing at first, but best practise is a reverse domain like for example, is our domain, so our reverse DNS is
14) create a provisioning profile tieing a bunch of developers and devices to an app
Apparently this is easier in the new xcode organiser

15) in the project click target on the left, the info button on the top bar

16) change name in properties to match an existing app id domain

17) change build tab, provisioning profile to a matching profile
The most common problem when loading other peoples code is the build target. I dont know why but Apple removes the older build version code from xcode.
Hell I guess it keeps the file size down and considering xcode download is like 3 gb, thats certainly a valid decision, but apparently if you do want to compile for older versions you can get them from another install of xcode with that version and simply copy the files.
However as Apple tries to make super clear… You should be building for the latest firmware at all times. With older versions simply a compatibility concern.

I hope this guide has been useful, its taken me a long time to work out all these little kinks and I thought perhaps some other people might find this info valuable.
I know its been particularly helpful for testing a web design on an iDevice or checking location services for brisbane website designs.

Wednesday, November 28, 2012 10:54:00 PM Categories: Android IT Mobile Phones