Installing a macOS guest onto an external USB disk with Virtualization.framework (sandboxed app)

Hello,

We develop a sandboxed Mac App Store app that runs virtual machines with Virtualization.framework on Apple silicon (macOS 27). Users want to
install a macOS guest onto an external USB disk and start the VM from it, so they can keep a VM on portable storage or on a disk larger than the
Mac's internal drive.

What we tried

  1. USB passthrough: we attach the disk before the VM starts, with VZUSBPassthroughDeviceConfiguration (from an AAUSBAccessory) on a
    VZXHCIControllerConfiguration.
    • Linux guests install onto the disk and boot from it without problems.
    • For a macOS guest, VZMacOSInstaller fails to start when the USB disk is the only storage:
    • As we understand it, a macOS VM can only start from its own storage devices, never from a USB device, so even a successful install would not
      boot.
  2. VZDiskBlockDeviceStorageDeviceAttachment: this needs an open file handle to /dev/diskN. That requires admin rights, which a sandboxed app can't
    obtain, so we can't use it in our App Store app.

Questions

  1. Is there a supported way to install a macOS guest onto an external USB disk and start the VM from it?
  2. Is there a sandbox-compatible way to get a VZDiskBlockDeviceStorageDeviceAttachment for an external disk, for example after user consent,
    similar to how AccessoryAccess grants USB devices?
  3. If neither is possible today, is support for this planned, or is there a recommended alternative?

Thank you for any guidance.

It doesn’t surprise me that you’re hitting issues here because Apple silicon Macs have a strong connection to their internal drive, and I always kinda assumed that this applies to virtual Apple silicon Macs as well.

Before I dig deeper into this, I have a quick question: Do you have to install directly to this USB drive? Or could you create a disk image on the drive and use that?

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Written by DTS Engineer in 913473022

Do you have to install directly to this USB drive?

Yes i need to directly install into usb drive. i can get this working for guest linux and windows and they are working fine. But for macOS i can install second guest instllation to usb storage in addition to that of the guest os in internal drive as we do now with phsical mac.

This raises me anothe question. why it is not possible to connect thunderbolt storages/devices directly to guest os? Is it possible to do in appstore sandbox mode.

Thanks