Categories
Guides Hackintosh Mac

MacOS in Virtualbox. It just works.

You can run MacOS in Virtualbox. Because? Because.

In the pursuit of Hackintosh, you need a Mac. That’s well and great, but I didn’t want to screw around with my partner’s Macbook. So what if you want to sandbox something? Virtualbox!

I had no expectations that this was going to work. OS X has always been runnable in Virtualbox for a while, but the performance has normally been lacklustre. While it’s not exactly daily-driver level, the performance in Virtualbox wasn’t too bad!

The macOS Virtualbox option is designed for genuine Apple hardware. You will not get community support from Virtualbox if you have trouble with this process, as it’s against Apple ToS.

πŸ€”οΈ What do I need?

You need a donor Mac to start this process. You will not need access to it permanently, but just during the process of creating an ISO for your VM to setup with. Else, you need:

This guide will discuss installing MacOS Mojave, however installation process should be similar for all MacOS versions.

⚠️ At the time of writing, Virtualbox and Hyper-V cannot co-exist on Windows. MacOS is also not installable on Hyper-V. I use Linux in my screenshots as I use Docker on Windows. This also includes Windows Subsystem for Linux, which tripped me up from installing.

πŸ’ΏοΈ Creating the ISO

Virtualbox installs generally prefer to use an ISO file, which unfortunately will require some handiwork to get a hold of. Persevere and you will get there!

On the MacOS machine, download the Mojave installer. Don’t worry about actually running this application, as we’re going to use some terminal magic to build the ISO from the package.

This process is not affected by MacOS Installer expiry. If your MacOS installer has expired, you can continue with this guide.

Once the package has been downloaded, pop open Terminal (Utilities folder in Launcher), and run the following commands:

hdiutil create -o /tmp/Mojave.cdr -size 8000m -layout SPUD -fs JHFS+

This will create a virtual ‘disc’ stored in your temporary directory. This is what we’ll stuff the Mojave installation stuff into.

hdiutil attach /tmp/Mojave.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/installer_goes_here

Now MacOS can ‘see’ your disc as an actual disc, ready for writing to!

asr restore -source /Applications/Install\ macOS\ Mojave.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/installer_goes_here -noprompt -noverify -erase

We’re now grabbing the installation DMG from within the updater package, and storing it within the disc image. This will rename the disc image, so don’t panic that ‘installer_goes_here’ has vanished.

Now, detach the image from our MacOS. You can just eject it like regular DMGs. If not, run the command:

hdiutil detach /Volumes/OS\ X\ Base\ System

(it may change since OS X is legacy. To check, run ls /Volumes and see if it’s there, renamed).

Now for the final process, let’s convert our CDR image to an ISO!

hdiutil convert /tmp/Mojave.cdr.dmg -format UDTO -o ~/Desktop/Mojave.iso

You should now have a file on the Mac desktop called ‘Mojave.iso’. Congratulations, you have your installation disc! Copy this over to where your Virtualbox is setup. The Mac is no longer needed at this point.

πŸ› οΈ Setting up Virtualbox

⚠️ Before continuing, install the Virtualbox Extension Pack, if you haven’t already. This comes with a special USB 3 driver that without, the Mac simply won’t see USB devices.

Virtualbox has the option for a MacOS virtual machine in it’s New VM dialog, but we will need to make further adjustments to make it truly Mac-ready.

Pop open Virtualbox, and Create a new Virtual Machine. Name this MacOS Mojave, and set it to Mac OS X (64-bit).

Screenshot of the 'Create Virtual Machine' dialog from Virtualbox. In the screenshot, 'name' is set to 'MacOS Mojave', 'Type' is set to 'Mac OS X' and 'Version' is set to 'Mac OS X (64-bit)'.

Set the RAM to 4096 MB (or higher if you can achieve it!).

When creating the disk, you can use either format versions. Dynamic will not immediately take up the storage size you chose, whereas Static immediately reserves the chosen size for the VM. The latter is slightly better for performance.

Screenshot of the 'Create Virtual Hard Disk' dialog, with 40 gigabytes set to the storage size.

Now you should have a new, primed MacOS machine. But you will need to run some commands now. This can be hit-and-miss, and may require some Google-fu. The following works for my AMD FX computer:

VBoxManage modifyvm "MacOS Mojave" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage modifyvm "MacOS Mojave" --cpu-profile "Intel Core i7-6700K"
VBoxManage setextradata "MacOS Mojave" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "MacOS Mojave" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "MacOS Mojave" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "MacOS Mojave" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "MacOS Mojave" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Windows? Change VBoxManage to "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" (if you didn’t change your Virtualbox install location).

The above does the following, in order of command:

  • Sets a known CPU ID set that MacOS will recognise.
  • Especially for AMD machines, changes what MacOS sees as your processor to something it supports.
  • Tells MacOS you’re installing Mojave onto a mid-2010 iMac. You can change this to your preference.
  • These two specify a fake DMI, typically found in Apple PCs.
  • A device key to pass system checks.

Before starting the VM, open the VM settings and make the following changes:

  • System > Processor > Processor(s) is 2 or more.
  • System > Acceleration > uncheck Enable Nested Paging.
  • Display > Screen > Video Memory is 128MB.
  • USB > USB 3.0 Controller.

With all that done, we’re ready to start the VM!

You should be greeted with the following screen:

The 'Select start-up disk' dialog is shown, with the default 'host drive' currently selected.

Click on the folder icon, and find your ISO created on the Mac before, then click Start.

And wait. yes, this process takes a long time. If your installation stops, try googling the last output message to see if there is a community fix, or post below… Otherwise, this is generally a slow process.

If all has gone well, you should be greeted by the MacOS installer language selection. If so, you’re almost there! On the top menu, open Utilities > Disk Utility.

There should be a disk named VBOX HARDDISK or similar. This is the VDI you created during the setup process, and not your actual hard drive. So go ahead and full-erase this disk, with Mac OS Extended (Journaled) and GUID Partition Map.

A screenshot of Disk utility on MacOS, intending to erase VBOX HARDDISK Media. The Name is set to Untitled, Format set to Mac OS Extended (Journaled), and scheme set to GUID Partition Map.

Once the disk formatting has completed, close it down. You should now be able to start the installation!

Once this is complete and you filled all the required details in, congratulations! You’re running MacOS Mojave within Virtualbox!

πŸ‘οΈ What works?

βœ”οΈ Does

  • Screen (No 3D).
  • Regular input methods (mouse sharing).
  • Networking.
  • USB devices.
  • Mac App Store.

❌ Does not

  • Full graphics.
  • Audio.
  • Guest additions.

At the end of the day it’s still a virtual machine, and a technically unsupported one at that. However, considering the matter it’s still impressive how Virtualbox can cope with MacOS.

Files can be shared using typical Windows share features. If you share a folder on your network from your host machine, your Mac VM should be able to connect to it.

🌟️ Special Thanks

This required a lot of Googling, and these are the people who saved me at the end of the process!

πŸ› Troubleshooting

You get Guru Meditation, “A critical error has occurred while running the virtual machine and the machine execution has been stopped” when machine gets to RandomSeed.

This is a difficult one, and will require investigation. I checked the logs as the error message said, and discovered:

HM: HMR3Init: Attempting fall back to NEM: AMD-V is not available

If you’re on an Intel processor, it’ll likely say VT-x instead.

Obviously, check if this is enabled. If you’re on a legacy BIOS computer, it’s a straightfoward scan for AMD-V/VT-x in your settings. If it’s UEFI, you’re gonna have to Google it.

Strangely, on my machine it was enabled. Supposedly Virtualbox and Hyper-V can run side-by-side, so at this point I decided to remove Hyper-V, to see if that would improve. It didn’t, but I forgot something. For this to work, you must turn off Windows Subsystem for Linux!

I completely forgot that WSL uses Hyper-V, and apparently still does when it’s disabled. Unfortunately, it would seem (for me at least) you need to trade it off for macOS in Virtualbox.

I will retest this when WSL2 is launched.

Categories
Hackintosh Mac

Toshiba Satellite Pro L850, Mojave Hackintosh Revisited

Back in 2018 I turned my laptop into a Hackintosh device, running High Sierra. I had a donor MacBook mid-2010 that I used to run TonyMac tools to get Hackintosh working. It was a fun if complicated process of trial and error, but the result was always impressive – a craptop unexpectedly booting macOS.

I eventually wiped macOS and re-installed Windows for a WordCamp coding session. The laptop proved to be quite a letdown, and now sits on a shelf collecting dust.

So, let’s Hackintosh it – again!

πŸ›‘ If You’re Attempting This…

I hate it when some guides forget to do this, but if you want to try this yourself, you absolutely must have the following or you won’t be able to do it:

  • An existing Mac or Hackintosh to build the USB on.
  • A copy of Install macOS Mojave.app. I can’t legally provide mine and they do expire, so fresh is good!
  • My laptop is Toshiba Satellite Pro L850-1UJ. Other L850’s might have a different setup.
  • A large capacity (8GB+) usb storage device.
  • Dedicate the laptop – you will erase everything on it.

If you can’t fufill these, then stop now. You’ll be wasting your time. If you want to see roughly how Hackintosh works or how my experience was, then please read on!

🧐 What Does and Does not Work?

This is from my current setup. They might actually have working configs that I’ve yet to find. If you know any, please comment below!

βœ”οΈ Does

  • Screen (full graphics).
  • Display brightness.
  • Keyboard & trackpad.
  • Battery monitor.
  • USB.
  • Ethernet (fixes AppStore).
  • Speaker audio.

❌ Does not

  • Suspend.
  • WiFi.
  • Keyboard brightness controls.

I happened to have both the Edimax and TP-Link USB wireless adapters, which worked with Chris1111 drivers.

πŸ•“ Changes from 2018

Instead of relying on TonyMac software, I’ve decided to attempt Hackintosh Vanilla. To quote the website:

A vanilla setup implies that the OS itself remains relatively untouched – and that the bulk of the Hackintosh-related kexts, patches, etc are contained on the EFI partition. For all intents and purposes, a vanilla install’s main partition is identical to that of an official Apple computer.

hackintosh.gitbook.io/-r-hackintosh-vanilla-desktop-guide

Other than the different approach, I had the following caveats:

  • Instead of High Sierra, I’m installing Mojave.
  • My MacBook blew up*, so I’m using a combination of Virtualbox and my partner’s Macbook Air.
  • This time, I will not be undoing it. This will be a continuous project until the laptop dies.

*An important point I must raise here. I bought my mac from an eBay listing a few years back. One day I plugged it in and it literally blew up. Smoke came from the plug and I had a residual shock. I put the MacBook and the dead charger in a cupboard and forgot about it. Recently, I pried open the plug to find it was a fake (or a non-recall), and the fuse was bypassed. Please, check your chargers! I now have a plug in RCD when using eBay auction purchases, just in case…

πŸ‘©β€πŸ’» The Process

Setting up a Bootable USB

My trusty SanDisk Cruiser was still lying around, but I’d long since wiped it. So I wiped it without a moment’s consideration of the content (not recommended, of course) and prepped it for being a macOS conduit!

Installer expires?!

Now I keep an archive of macOS installers because… Well, I don’t really know why. Using my partner’s Mac I created a bootable macOS drive using an archived Mojave, only to find I got the error:

This copy of the Install macOS Mojave application is damaged, and can’t be used to install macOS

So it turns out these macOS installers expire! Like a bad carton of milk, macOS would simply refuse to run (other tools like Disk Utility and Terminal were fine). I tried multiple solutions I found on Google to bypass it, but none worked.

It would seem that Apple sign a certificate on the day you downloaded the installer from them. If you wait too long, macOS deems it damaged. You appear to be able to reset the system clock or edit the date via Terminal, but you need to know when your package was signed. Unfortunately, I didn’t note the date down. I discovered however I could re-download it from Apple still. Phew!

Back on track (and still on my partner’s Mac), once I had created the Bootable USB, I used Did’s autobuild of Clover to install Clover onto my USB. Complete shout-out to anyone who works on Clover in any form, as this fantastic bit of kit is what will get your Mac installation drive booting on a PC, and beyond!

In my previous attempt I had a config.plist that worked wonders with my current setup. However, the default config that comes with Did’s Autobuild was apparently completely fine for this laptop. This makes a great starting point!

I ran the Clover Installer package, changed the location to my USB drive, and didn’t change a damn setting. Install, and (safely) yanked that newly primed Hackintosh stick out.

UEFI/BIOS Changes

This laptop comes with UEFI and legacy BIOS mode. Supposedly Clover works with both, but for my install I enabled UEFI mode and disabled safe boot. Saved changes and exited.

Smashing F12 like the refresh button, My trusty Toshiba asked what to boot from. What else but the Macintosh conversion stick?!

I left Clover alone, and it booted straight into the Mac recovery screen. Now, if you’re going to commit to this make damn well sure your Toshiba has nothing important stored on it, and is backed up! This process (or at least how I did it) will erase everything!

Pop open Disk Utility from the Utilities menu. I had to click the button at the top left and show all devices. On my main hard drive (not the USB stick) I selected it and chose erase. I made sure to choose Mac OS Extended (Journaled). APFS might be supported, but I’d rather use the tried-and-true format, and the GUID Partition Map. Hooray, the whole disk is now in Mac format!

Excluding the certificate expiry, the installation ran without a hitch. My network adapters (ethernet and wireless) were not detected so I opted to install without connecting to the internet. I also selected British – PC as my keyboard format, which seems OK except alt and special are swapped round.

Storm through the install like a regular Mac. After a lot of waiting and reboots, you’ll be greeted with the Mac screen. Hooray, you’re done(ish)!

πŸ›  Getting Stuff Working

Most things are working at this point, or at least the most important stuff. Networking, sound, and laptop detection are not.

As a basepoint, I found this config.plist from RehabMan worked well as a jumping point (not to replace the main config.plist).

I used the following kexts (In the EFI partition, in Clover/Kexts/Other):

  • FakeSMC, what doesn’t this one do?
  • Lilu, a dependency for almost all Hackintosh kexts.
  • VoodooPS2Controller, enables keyboard and trackpad.
  • ACPIBatteryManager, battery is detectable by MacOS.
  • NativeBacklight, MacOS detects display has adjustable brightness.
  • OSX Realtek Network, by RehabMan.
  • VoodooHDA for Intel HD Audio out speakers.

Great. With the above, your keyboard, trackpad, audio, battery, brightness & wired network now work.

Native backlighting took some jiggling to get working. RehabMan on TonyMac has a great guide to getting this working (I installed the kext into Clover, not MacOS).

🧐 The Verdict

I’ve actually been finding the performance on this base-spec (inc. original hard drive) runs really well on MacOS. There are slowdowns, and I have not tried gaming on this machine, but nothing more than I would expect from a very old machine. Plus Apple tends to care for their ageing old Intel machines really well, so I’m not too surprised.

The lack of sound and wireless networking is troublesome though. I make do with a USB wireless dongle, but until I can find a solution to let MacOS see my actual WiFi card, I may not be able to upgrade to MacOS Catalina. The lack of ethernet detection also causes problems with the Mac App Store, which seems to always reckon I’m not connected (despite updates downloading just fine).

So, I’m gonna keep it!

πŸ€– The Future

With no dire need to use this laptop (the battery is really dead), I’m going to persist on trying to get Hackintosh to work as much as possible. It really does feel rewarding, and you never get tired of the shock some people have when they see your craptop suddenly boot MacOS.

Although they will question “why not buy a real Mac

Article updates
  • 2020-07-07 – Audio now functions via kext.
  • 2020-07-02 – Updated does/does not work list.
  • 2020-06-14 – Ethernet working with RehabMan’s kext.