Home Assistant

How to Run Home Assistant on a Mac mini with UTM (Full Setup Guide)

7 min read

I've been running Home Assistant on a Mac mini for about eight months now, and it's turned out to be one of the best decisions I've made for my smart home. In this guide I'll show you exactly how I set it up using a free app called UTM, how to make sure it comes back on its own after a power cut, and the handful of lessons I learnt the hard way so you don't have to.

Why Run Home Assistant on a Mac mini?

I originally bought a base model M4 Mac mini to run local AI, an Ubuntu virtual machine that streams my vinyl to AirPlay, and to act as a simple NAS for a few drives. Since it was on all the time anyway, it made sense to put Home Assistant on it too.

If you already have a Mac that stays on, or you're happy to pick up something like a second-hand M1 Mac mini, it's a great home for Home Assistant. It's low power, completely silent, and you can still use it as a normal Mac at the same time. The same goes for an iMac that never gets switched off.

You might be wondering why not just use Docker. You can run Home Assistant in Docker on a Mac, but it doesn't work as well. You lose network discovery, one-click backups and a few other features. Running the full Home Assistant Operating System in a virtual machine gives you the complete experience.

What You'll Need

  • A Mac that's always on, ideally connected to your router with Ethernet.
  • UTM, a free virtual machine app for Mac. There's also a £9.99 App Store version that's exactly the same, it just updates itself automatically.
  • The Home Assistant OS image from the Home Assistant GitHub releases page (github.com/home-assistant/operating-system/releases). Click the latest release (18.3 when I set this up), scroll down to Assets, and download the file named haos_generic_aarch64 ending in .qcow2.xz.
  • A UGreen Powered USB-C Hub if you plan to plug in external hard drives as well as a Zigbee, Matter or Bluetooth dongle. I'll explain why this matters later, but it's the single biggest reliability fix I've found.

Step 1: Unzip the Home Assistant Image

Head to your Downloads folder and double-click the file you just downloaded to unzip it. Once it's extracted you can delete the original .xz file.

Step 2: Create the Virtual Machine in UTM

Open UTM and choose Create a New Virtual Machine, then work through the options like this:

  1. Choose Virtualize.
  2. For the operating system, pick Other.
  3. Set the memory to between 4GB and 6GB. 4GB is plenty for most homes.
  4. Set CPU cores to 2.
  5. For Boot Device, choose None but leave UEFI Boot ticked.
  6. Leave the storage as it is. We'll swap the drive out shortly.
  7. You can share a folder between your Mac and the VM if you like. I did, but it's optional.
  8. On the summary screen, name it Home Assistant, tick Open VM Settings and hit Save.

Step 3: Tweak the VM Settings

The settings window opens next, and there are a few things to check.

System and QEMU

Under System, make sure the architecture is set to ARM64. Then go to QEMU and check that UEFI Boot, RNG Device and Use Hypervisor are all ticked.

Input (for USB dongles)

This one's important if you want to use a dongle like the Home Assistant Connect ZBT-2 or a SONOFF Zigbee Dongle. Set USB support to USB 3.0 (XHCI) and tick USB Sharing.

Network

Choose Bridged mode. This gives Home Assistant its own IP address on your network, which you can lock down as a static IP in your router later. Pick Ethernet as the interface if that's how your Mac is connected, use the virtio network card, and leave the MAC address on random.

Step 4: Install Home Assistant

All the settings are right now, but Home Assistant isn't actually installed yet. To fix that:

  1. Click the VirtIO drive at the bottom of the sidebar and delete it.
  2. Add a new drive, choose Import, find the Home Assistant file you unzipped and click Open.
  3. A new VirtIO drive appears. Hit Save.

Step 5: Keep UTM Running

In the menu bar, go to UTM > Settings and turn on the menu bar icon, the option to prevent sleep while any VM is running, and the option to keep UTM running when you close the window. Then right-click UTM in the Dock and choose Open at Login.

Step 6: Stop Your Mac from Sleeping

A sleeping Mac means a sleeping smart home, so open System Settings and go to Energy. Turn on Wake for network access and Start up automatically after a power failure.

You may also want your Mac to log in automatically, so that after a power cut everything starts up without you touching it. You'll find this under Users & Groups > Automatically log in. It only works with FileVault turned off, so there is a security trade-off here and it's worth thinking about before you do it.

While you're in System Settings, it's also worth going to General > Software Update and turning off automatic updates. That way you decide when your Mac restarts, not macOS.

Step 7: Start Home Assistant Automatically

UTM opening at login isn't quite enough, because the virtual machine itself also needs to start. I use Automator for this.

  1. Go to Applications > Other and open Automator.
  2. Click New, choose Application, and add a Run Shell Script action.
  3. Paste in the three lines below. If you named your VM something other than Home Assistant, change the name in the last line.
  4. Save it as Start Home Assistant, then add it under System Settings > General > Login Items.
open -a UTM
sleep 20
/Applications/UTM.app/Contents/MacOS/utmctl start "Home Assistant" --hide

Step 8: First Boot and USB Devices

Head back into UTM and press play. On the first start, click the USB icon at the top of the VM window, pick any dongles you want Home Assistant to use, choose Connect and turn on Auto Connect on Start. The virtual machine will then grab those devices every time it boots.

That's it. You now have a brand new Home Assistant install ready to set up in your browser, and from here it's the normal Home Assistant onboarding.

What I've Learnt After 8 Months

For the most part this setup has been really reliable, but there are three things I'd want to know if I were starting again.

1. USB power is the big one

The Mac handles USB power fine until you start plugging in hungry devices like external hard drives. At that point your Zigbee or Matter sticks can randomly disconnect because they're not getting enough power, which is obviously not what you want from a smart home.

The fix is simple. Plug your Home Assistant dongles straight into the Mac, and put everything else through a UGreen Powered USB-C Hub. It has to be a powered hub. That one change solved the only real problem I've had with this setup.

2. Turn on IPv6 for Matter

If you use Matter devices, turn on IPv6 in your router settings. It makes a big difference to reliability. While you're in there, set a static IP for your Home Assistant virtual machine too.

3. Use a Bluetooth proxy

Bluetooth is the awkward bit. Bluetooth 5 dongles that work with a Mac are almost impossible to find, Bluetooth 4 ones don't have the range, and you can't share the Mac's built-in Bluetooth with a virtual machine. The best answer is an ESP32 Bluetooth Proxy. It's cheap and easy to set up, and I've got a full video walking through it on my YouTube channel.

Is a Mac mini Good for Home Assistant?

For me, absolutely. My M4 Mac mini runs Home Assistant reliably alongside everything else I use it for, it costs very little to keep on, and I never hear it. If you've got a Mac that's on all the time anyway, or you can find a cheap M1 Mac mini, it's a brilliant way to run Home Assistant without buying a dedicated box.

All the commands and settings from this guide are on my GitHub at github.com/marktiddy/home-assistant-tutorials, so you can copy and paste them straight in. If you have any questions, leave a comment on the video and I'll do my best to help.