UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Add USB sharing option to macOS guest (from macOS host)

Open natevw opened this issue 2 years ago • 12 comments

With an e.g. Windows guest UTM offers sharing settings including for USB devices:

Screen Shot 2022-03-14 at 3 26 33 PM

But no such settings are available for a macOS guest:

Screen Shot 2022-03-14 at 3 26 05 PM

Can USB devices be shared with the new Virtualization framework? [Update: fwiw, I'm sure not seeing anything related to USB passthrough in Apple's https://developer.apple.com/documentation/virtualization overview documentation… ☹️ ]

(Sorry if this is a duplicate, I could not find one. This is in a somewhat similar vein as https://github.com/utmapp/UTM/issues/3567 — the new Virtualization.framework is still missing some features compared to the QEMU settings. File sharing is another such but I'm focusing this request on USB specifically since there's userspace options for transferring files, but not really any good workaround for passing through a USB device.)

natevw avatar Mar 14 '22 22:03 natevw

Hello,

I asked this question on Twitter few weeks ago : https://twitter.com/Valkhes/status/1481192075672629253?s=20&t=ZCdAmzI9b3KW1p2CD2rE0g

This is the feature I'm also missing to be able to use macOS VM, but it seems that it is not currently supported by Apple in Virtualization.framework . Right now, it seems that no options are available at all, I also tried other apps like Parallels for example, and they are not supporting it too. Even USB over IP solutions right now can't use a mac M1 as a guest to receive an USB device, which would have been a great workaround for me.

This looks to be for the moment a dead end until Apple can support it.

Valkhes avatar Mar 15 '22 12:03 Valkhes

It is indeed dependent on Apple support. We have to wait until WWDC to see what's next for Virtualization.framework.

osy avatar Mar 17 '22 01:03 osy

Is there news/work-around on this?

tucnak avatar Jul 30 '22 05:07 tucnak

These look like they're relevant:

Entitlement for Virtualization Guest USB access

Apple docs aren't exactly self explanatory but it seems like these would be used to open a connection to an interface or specific device and then you could use something like SPICE's usbredir for the VM end.

(https://developer.apple.com/documentation/iousbhost/iousbhostobject) (https://developer.apple.com/documentation/iousbhost/iousbhostdevice) (https://developer.apple.com/documentation/iousbhost/iousbhostinterface)

Further investigation seems as though this may only work for Hypervisor.Framework.

blue-beret avatar Nov 04 '22 04:11 blue-beret

Yeah we use them in QEMU. This issue is about Apple Virtualization.

osy avatar Nov 04 '22 05:11 osy

With Sonoma we can share a block device with guest, is this feature helpful?

ZeppLu avatar Dec 25 '23 10:12 ZeppLu

Hi, I'm just a bit curious. I tried Parallels Desktop, they have a 'Rosetta' switch in vm settings, and even when I enable it, I can still share my usb device into the vm. So do you think Apple Hypervisor has the ability to share USB, or Parallels achieve this in some tricky way?

jdjingdian avatar Jan 09 '24 12:01 jdjingdian

Hi, I'm just a bit curious. I tried Parallels Desktop, they have a 'Rosetta' switch in vm settings, and even when I enable it, I can still share my usb device into the vm. So do you think Apple Hypervisor has the ability to share USB, or Parallels achieve this in some tricky way?

After some research, I think the Rosetta does not really need the Apple Hypervisor to run, its kind of apple's limitation. There is a repo that patch previous version of rosetta and let it run on any arm64 linux. https://github.com/CathyKMeow/rosetta-linux-asahi I tried it on a vm manage by qemu, and it works.

So maybe parallels did not actually use the Apple Hypervisor as backend.

jdjingdian avatar Jan 10 '24 02:01 jdjingdian

I tried Parallels Desktop, they have a 'Rosetta' switch in vm settings, and even when I enable it, I can still share my usb device into the vm.

I believe you're referencing Linux guest, since PD does not support USB passthrough in mac guest either.

ZeppLu avatar Jan 15 '24 18:01 ZeppLu