With tools like Ionic or Cordova we have the possibility to create performant multi-platform apps for Android/iOS and the web. But there is a problem.

Building and testing the iOS version of their app without a Mac is nearly impossible, you could use some cloud build services but the debugging options are very limited to nonexistence.

Fortunately there is a solution that doesn't contain buying a new Mac. Just run osx under a virtual machine on your normal computer.

Install osx on a VirtualBox

There are hundrets of tutorials on youtube how to install osx under VirtualBox for linux. I used this one. (keep in mind that you can't necessarily trust the download sources)

The main points todo are :

  • Download the osx image
  • Install VirtualBox
  • Execute the vboxmanage script to make VirtualBox compatible for osx
  • Install osx

Now we have a working version of mac osx running. We can install XCode and enjoy the iOS simulator. But if we want to connect a real iPhone device we have to make more changes for the virtual machine to be able to recognize our ios device.

There seems to be a lot of dark magic involved to make the iPhone connection work under a virtual machine but the following 3 steps should help you succeed

Virtualbox extensions

To have usb support for VirtualBox we have to install the VirtualBox extensions. Most people probably use the open source version of VirtualBox via the ubuntu package manager. To install the extensions for this version execute this command (source)

VBOXVERSION=`VBoxManage --version | sed -r 's/([0-9])\.([0-9])\.([0-9]{1,2}).*/\1.\2.\3/'`
wget -q -N "http://download.virtualbox.org/virtualbox/$VBOXVERSION/Oracle_VM_VirtualBox_Extension_Pack-$VBOXVERSION.vbox-extpack"
VBoxManage extpack install --replace Oracle*.vbox-extpack

On Ubuntu 17.04+:

sudo apt install virtualbox-ext-pack

No usb at all?

The first problem you could have is that vbox doesn't have access to your usb devices at all. In this cas just execute this command to add your user to the vboxusers group.

sudo adduser YOURUSER vboxusers

After this modification you might need a restart.

Setting up the USB

In your VirtualBox settings you have to enable a USB controller and then choose the "USB 2.0 (EHCI) Controller". With the other controllers your XCode won't be able to make a connection to the iPhone.

Once you have done all this steps you should be able to connect your iPhone and see it under usb devices in VirtualBox. If not check first if you iPhone appears under your Linux system. I can add from own experience that sometimes just changeing the usb ports seems to help.

I hope this mini tutorial helped you getting started developing iOS apps under Ubuntu/Linux.

Links :

Upgrade to High Sierra 10.3.6

I followed some great articles/forum posts but ran into the following error:

validate_root_image: validating root dmg /macOS Install Data/BaseSyste.dmg

I had some wrong settings in my virtual machine. Verify that your virtual machine has 2 processors active and (probably) USB3 activated. I hope this will not interfere with the iPhone real device debugging but we'll see