Both the two commercial OS X virtualisation options – VMware Fusion and Parallels Desktop – allow you to create a virtual OS X installation, something that Apple allows via its license agreement. Just click More Options when creating a new machine in Fusion, or the right arrow under the Free Systems heading when creating a new machine in Parallels.
Unfortunately, with the free-of-charge Oracle VirtualBox it’s a lot more difficult, although VirtualBox is compatible in theory.
Over at the InsanelyMac forums, user fusion71au has written a fairly simple guide to getting OS X El Captain up-and-running within VirtualBox. Unlike many similar guides, his instructions don’t involve downloading illegally hacked system files. Instead they make use of built-in Mac command-line tools.
Because his steps are written for Windows users, they need slight modification for Mac users – under the heading “Patch El Capitan vbox configuration file with MBP 11,3 DMI Settings”, you’ll need to open a Terminal window (it’s in the Utilities folder of the Applications list in Finder), then type cd before dropping the VirtualBox app’s icon direct from the Applications list onto the Terminal window. After hitting Enter, type the following:
Then type the commands as listed within the tutorial, although you’ll need to leave off the .exe file extension on the first command because, again, this isn’t Windows!
Running OS X within VirtualBox (or indeed any virtualised environment) is a rather rough experience. You’re limited to 1024×768 resolution, for example, and there’s no Quartz Extreme or Core Image support, so animations are choppy and slow. However, for basic testing of apps in a virtualised environment it works pretty well. And with a $0 price tag, who can complain?