iPhone Development in Ubuntu Linux

Here is what I did to setup Snow Leopard with xcode in Virtualbox and deploy my work to my iPhone.

I’m running Ubuntu Linux on my Asus A52J laptop with an Intel i3 CPU and 2 GB of RAM

UPDATE: Virtualbox 4 keeps aborting when I add my iPod to snow leopard. I’ve reverted back to using version 3.2.12. Please let me know if you get it working in version 4.

Install Snow Leopard
www.sysprobs.com has many useful tutorials for installing Snow Leopard in Virtualbox. I used this one for installing it on my Intel i3: http://www.sysprobs.com/mac-os-snow-leopard-intel-i3i5-i7-processors-virtualbox

You will need a copy of snow leopard. I first downloaded a copy of Snow Leopard and then purchased a copy after I had confirmed everything was working. If you decide to do this then please don’t be a pirate by not purchasing a copy after you have everything working. You can probably pick up a secondhand copy of Snow Leopard somewhere for a good price.

You will also need eboot.iso because Virtualbox will not be able to boot directly into Snow Leopard.

Next, download Virtualbox and create a machine with the following setup:

  • Set OS to Mac OSX and version to Mac OSX Server
  • Create a dynamically expanding hard disk of with a size of 25GB or more. Snow leopard and xcode will take up almost 20GB combined. Set memory to 1024MB (or more if possible). I first tried to install OSX under Windows 7 but I always got an out of memory error during installation. It looks like Ubuntu only uses a small amount of memory.
  • Enable 3D Acceleration and set video memory to high.
  • Disable EFI
  • Enable IO APIC, PAE/NX, VT-x/AMD-V, Nested Paging

Start the virtual machine and boot from the eboot.iso, and then inserted the snow leopard DVD and mounted it. Then hit refresh and press the right arrow key to select it and hit enter.

Once the installation screen appears, select English and in the next screen go to the disk utilities and create a new partition on the virtual hard disk. Then install snow leopard on it.

Upgrade snow leopard and install MultiBeast

Xcode requires 10.6.3 or later. If your version is less then you’ll need to upgrade.
Download the 10.6.5 upgrade and MultiBeast to your snow leopard installation.

Install the upgrade and when it tells you to restart your computer at the end, DO NOT. Instead install MultiBeast and then restart. If you restart after the upgrade but do not install MultiBeast, then you may experience problems, like your mouse no longer working!

Installing Xcode and the iOS SDK

You can download xcode with the ios sdk from the apple website. It is a big file, around 3.5GB.
Install xcode. This should be fairly easy provided you have enough space. After installation it will take up almost 10GB!

Deploying your work to the iPhone

There are two ways to do with. The first option is to pay Apple $99. This is definitely the easiest option and probably the best if you are sure you will release something to the Apple store.

The other option allows you to test your work for free, but it does require a jailborken iPhone.
Install AppSync on your iPhone via Cydia.
In snow leopard

Applications > Utilities > Keychain Access
Certificate Assistant > Create a Certificate
Create new certificate

Name: iPhone Developer
Certificate Type: Code Signing

Accept defaults for everything else and click continue until certificate is created

Edit /Developer/Platforms/iPhoneOS.platform/Info.plist
Replace all instances of XCiPhoneOSCodeSignContext with XCCodeSignContext

In xcode: Project > Edit Project Settings > Build
Set code signing identity to the certificate you just created.

Also, to deploy for earlier version of iOS, like iOS X 4.1. Change deployment version

Setting up a shared folder
You’ll probably want to transfer files from Linux to snow leopard at some stage. The easiest option is to use NFS.

sudo apt-get install nfs-kernel-server
vim /etc/exports

I added the following line to the exports file. The * means anyone can mount it.

/home/your_name/shared_dir_on_host    *(rw,insecure,no_subtree_check)

Ideally you would want something like this

/home/your_name/shared_dir_on_host    mac_os_host_name(rw,insecure,no_subtree_check)

But I couldn’t seem to get this to work. NFS is still quite new to me.

After editing the exports file you need to reload the settings:

sudo /etc/init.d/nfs-kernel-server restart
sudo exportfs

Now in snow leopard open a terminal and mount the shared dir:

mkdir dir_to_mount_shared_dir_on_snow_leopard
mount ubuntu_host_name:/home/your_name/shared_dir_on_host dir_to_mount_shared_dir_on_snow_leopard

You may want to add this to a bash script for future.

Disable Screen Saver and Power Management

If snow leopard crashes after it is left alone for about 10 minutes, it could be because of the screen saver. It was in my case.

Under settings, disable the screen saver and the energy saving settings which turn off the hard drive and monitor.

Screen Resolution

Completely close Virtualbox and then enter this command from the terminal:

VBoxManage setextradata “VM name” “CustomVideoMode1″ “1280×800×32”

Replace VM name with the actual name of your virtual machine and likewise for the screen resolution.

Source: http://www.sysprobs.com/increase-mac-os-virtual-machine-screen-resolution-virtualbox-vmware-player

Go to this link and follow the instructions: http://forums.virtualbox.org/viewtopic.php?f=30&t=33358

The sound quality might not be perfect when you get it working, but it should be sufficient for development purposes.

4 thoughts on “iPhone Development in Ubuntu Linux

  1. viren

    thanks you sir
    this is very informative

    i am new in ubuntu and iphone

    can you provide me, best practice to start and become expert in pictorial form as it becomes easy to understand.

    i am using
    laptop : Sony Viao
    Processor : i3
    RAM : 4GB
    OS : ubuntu 10.10

    thanks and regards

    1. Rohin Knight Post author

      So how far did you get with setting up Snow Leopard with Xcode in Virtualbox? You could also try setting it up in VMWare Player. And it probably wouldn’t matter in your case whether you used Windows or Linux seeing as you have 4GB. The reason I used Ubuntu was because I ran into memory problems under Windows because I only had 2GB.

  2. Luca Seemungal

    so you want to install ubuntu in a sony vaio? aww…. shit thats gonna be hard because sony build the circuits for windows, everything specifically for windows. U r gonna have to know a lot about what you are doing

    1. Nishant Barot

      its not like that. Every machine accet any os expecting Mac. Only apple is designed for mac no any other os. Sony Vaio is made for every os. I have 1 windows os and two linux os 1)linux mint 2)ubuntu 10.04. My machine works properly its not take any load.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s