Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
natevw opened this issue Mar 14, 2022 · 22 comments
Open

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

natevw opened this issue Mar 14, 2022 · 22 comments
Labels
enhancement New feature or request

Comments

@natevw
Copy link

natevw commented Mar 14, 2022

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 #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 natevw added the enhancement New feature or request label Mar 14, 2022
@Valkhes
Copy link

Valkhes commented Mar 15, 2022

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.

@osy
Copy link
Contributor

osy commented Mar 17, 2022

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

@tucnak
Copy link

tucnak commented Jul 30, 2022

Is there news/work-around on this?

@blue-beret
Copy link

blue-beret commented Nov 4, 2022

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.

@osy
Copy link
Contributor

osy commented Nov 4, 2022

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

@ZeppLu
Copy link

ZeppLu commented Dec 25, 2023

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

@jdjingdian
Copy link

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
Copy link

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.

@ZeppLu
Copy link

ZeppLu commented Jan 15, 2024

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.

@solarispika
Copy link

solarispika commented Jun 11, 2024

Looks like Virtualization.framework has new USB support now.
https://developer.apple.com/documentation/virtualization/vzvirtualmachineconfiguration/4360569-usbcontrollers?changes=latest_minor&language=objc
Does it help on USB-sharing?

@jredbart
Copy link

jredbart commented Jul 8, 2024

Are there any plans to adopt the new virtualisation framework USB support with the upcoming macOS release?

@joshm89
Copy link

joshm89 commented Jul 12, 2024

Would be brilliant if we can get support for USB devices on a macOS host. I work on my personal device and would love to set up a separate macOS VM for work, but I need access to my webcam.

@conradev
Copy link

This would go great with the new iCloud support on macOS 15 because I use USB security keys to protect my Apple ID

@greatestradioshow
Copy link

Is the new virtualisation framework USB support already in place? Should I be able to see my iPhone in my VM or not? Because I can't make it work in Ubuntu via UTM on my M1.

@erikschul
Copy link

erikschul commented Sep 18, 2024

@greatestradioshow
Copy link

Do we know if this will be changed in the future?

If USB is not working in the VMs, what is the main use case of these VMs?
Maybe it is just me, but even when it looks like nowadays everything is happening in the cloud, I almost need my USB ports on a daily basis.

@erikschul
Copy link

@greatestradioshow I assume that you can check the roadmap, and if it's not on it, it's not on it 🤷

I suspect your comment is off topic, if you have similar questions you can ask in Discussions?

@greatestradioshow
Copy link

As GitHub is listed as an official support channel, I was just wondering to get an official statement to see, if this feature might come or will definitely not come (because of an macOS limitation).

@erikschul could you please share the link to the roadmap with me, as it looks like I can't find it.

@cmoog
Copy link

cmoog commented Nov 4, 2024

@osy I'm interested in a bounty on this issue. Specifically for USB passthrough for Linux guests using Apple Virtualization.

@osy
Copy link
Contributor

osy commented Nov 4, 2024

Unfortunately there's nothing we can do here. We need Apple to add usb host sharing to virtualization.framework

@natevw
Copy link
Author

natevw commented Nov 4, 2024

@osy Does the VZVirtualMachine.usbControllers configuration linked upthread at #3778 (comment) not expose this now?

@osy
Copy link
Contributor

osy commented Nov 4, 2024

It does not. It exposes a virtual USB controller for plugging in virtual USB devices. It does not have USB host redirection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests