OS X Lion virtual machine
The current Mac computer family is based on Intel x86-64 platform and also Mac OS X is optimized for current Intel processors. The only difference between IBM-PC and Macintosh lies in a special EFI BIOS that identifies that is needed for Mac OS X. However, third party developers established project called OSx86, better known as Hackintosh, which allows users to run Mac OS X on non-Apple computers, or in virtualization software.
So let's see how you can run latest Mac OS X Lion in virtual machine created in Oracle VM VirtualBox virtualization software.
How to install Mac OS X Lion to VirtualBox
Step 1 - Install VirtualBox to your computer
You can download free VirtualBox installation package from Oracle website. It has very straightforward installation without any complex settings.
Step 2 - Mac OS X distribution
They are few ways how to install Mac OS X to virtual machine. Advanced users can use original DVD with special boot loaders and test optimal settings for the best Mac OS X performance.
However, we used easier way with a pre-prepared installation image called iATKOS L2, that includes Mac OS X Lion and other utilities, patches as well as hardware drivers that allows users to install Mac OS X. You can Google for it and download it, for example on BitTorrents. Original iATKOS L2 is distributed in DMG format used for Mac OS X installation packages.
Step 3 - Create virtual machine
After you have installed VirtualBox and downloaded iATKOS L2 disk image, it is time to prepare the virtual machine.
To run Mac OS X in virtual machine you need to have processor with Intel VTx, or AMD-v hardware virtualization support. If you don't have it you can also try to install Hackintosh directly to your computer. Read How to create Hackintosh here.
Start VirtualBox and click on New option in the top menu. In welcome screen of the virtual machine wizard, click on Continue button.
Set the VM Name. Set OS Type to Mac OS X and set Version to Mac OS X Server or Mac OS X Server 64 on 64-bit systems (standard Mac OS X is not officially supported in VirtualBox). Click on Continue button.
Specify the name and type of OS
Set Base memory (RAM) to minimum of 1GB, if you can afford it set it to 2 or more.
Set the RAM size
In next Virtual Hard Disk screen uncheck the Start-up disk box → Click on Continue button. You will be warned by message, but ignore it and press again Continue button.
Warning message in VirtualBox wizard
In Summary window click on Create button and new virtual machine will be added to the VirtualBox virtual machine list.
Virtual Machine summary window
Step 4 - Virtual machine settings
Right click on new virtual machine and select Settings option in pull down menu. Go to the System tab and uncheck box with Enable EFI option.
VirtualBox virtual machine settings
Click on Display tab and set Video Memory to 128MB and check the box Enable 3D Acceleration.
Virtual machine video settings
Click on Storage tab → Click on hard drive icon next to IDE Controller option → Select Create new disk.
VirtualBox create a new virtual hard drive
In simple virtual disk creation wizard select VDI (Virtual Box Disk Image) option and click on Continue button → Storage details set to Dynamically allocated and click on Continue button → Set the name, location and size of virtual disk and click on Continue button (min. 15GB recommended) → On summary window click on Create button.
Now you are back to the Storage settings. Click on "Empty" optical drive → Click on Optical Disk icon in the Attributes area → click on Choose a virtual CD/DVD disk file... and select iATKOS L2 image. Now click on Open button and after that OK button.
Mount CD/DVD image in VirtualBox
Step 5 - Installing Mac OS X
Now the virtual machine is prepared for Mac OS X installation. Double click on new virtual machine and wait until the Mac OS X installation application started.
Select your language and click on Next arrow.
Mac OS X installation application
Now you need to prepare installation partition on virtual disk. Click on Utilities option in Top menu and select Disk Utility.
Mac OS X Installer Utilities
Select VBOX HARDDISK in Hard Drive list → Select Erase option → Format - Mac OS Extended (Journaled) → set the name of disk and click on Erase... button. Wait until formatting is finished and close the Disk Utility.
Mac OS X Disk Utility
You are back in the Mac OS X installation wizard → Click continue button and Agree with Read Me.
Select the installation hard drive and click on Install button. Now it is time for a break and wait until the installation process will be finished.
Mac OS X installation partition
After successful installation, the virtual machine will be restarted. If after restart the machine doesn't reboot, simply close the machine and select power off machine and start machine again.
Mac OS X install succeeded
After reboot, or restart you will see an Chameleon bootloader. Press F8 key to open boot option and select by arrow key bootable partition with new installed Mac OS X and press Enter.
iATKOS Chameleon bootloader
Wait until the Mac OS X will start Computer Setup Wizard, where you set configuration of your Mac like region, keyboard type, Apple ID, registration, computer account etc.
After the settings are complete you will be welcomed to Mac OS X Lion desktop.
Mac OS X Lion installed in VirtualBox
If you don't want to always use a mounted iATKOS installation image to boot up the system, go the System Preferences → Boot Loader → Boot Setup → check the Default Partition box and type to text box hd(0,2) to set bootable partition and close Bootloader Configuration. Now the system is able to boot without bootable image.
Chameleon Bootloader Configuration app in System Preferences
And that's it. You can now start to learn with Mac OS X operating system, install and test Mac applications as well as develop applications for Mac, iPhone or iPad with Xcode.
Screenshots in this article are from VirtualBox for Mac, but the same settings are working for VirtualBox for Windows and Linux.