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

Written by rbmanian75 in 913496022

Yes i need to directly install into usb drive.

Please elaborate to why that’s the case.

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

Okey here is a sample situation i have a M5 macbook air and have macOS 27 installed. I need to test my app on macOS 26 so i downloaded the macOS 26 installer and when i start the installer application it says cant run this on macOS 27. So i need a way to install macOS 26 or Sequoia on external storage so that i can test my app on macOS 26 and macOS 15. i need to boot those from external storage since i need virtualization to test my app. i cant test on vm. So it would be nice if i can install to external storage directly from a VM and use that external storage to boot directly from mac. If i have the vm already with macOS 26 installed on img file from that i can install tahoe to usb storage and use that boot directly from mac. it worked. So it would be nice if we can install directly to external storage. so that we can skip one step of have mac os 26 on img.

Users are also requesting the option to install to usb storage directly. I dont know their use case.