We are using VZVirtualMachine instances in a Swift actor. It works fine but we hit a major problem when we decided that we want to attach it to a VZVirtualMachineView to show it / allow user interactions.
VZVirtualMachineView and its virtualMachine property is isolated to @MainActor, so if we directly assign our vm instance to it, we receive a concurrency error:
@MainActor
public func createView() -> VZVirtualMachineView {
let view = VZVirtualMachineView()
view.virtualMachine = vm // x: Actor-isolated property 'vm' can not be referenced from the main actor
return view
}
Is there any way we can make this work?
Virtualization
RSS for tagCreate hardware-accelerated virtual machines to run macOS and Linux-based operating systems.
Posts under Virtualization tag
35 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Can the Xcode 26 code assist feature be used in a macOS 26 virtual machine? I am not seeing a way to enable it...
Also asking on https://github.com/insidegui/VirtualBuddy/discussions/524
I’m encountering an issue when trying to start a macOS VM using Apple’s Virtualization framework in a sandboxed environment.
When I create a standalone Xcode project, the VM launches successfully. However, when I integrate the same code into my existing project—where the VM is launched by a service started via launchd and running in a sandbox—it fails with the following error:
Internal Virtualization Error: Failed to issue USB HCI sandbox extension
To resolve this, I tried adding the com.apple.security.device.usb entitlement. But after doing that, the app started crashing with the following trace :
Application Specific Signatures:
SYSCALL_SET_USERLAND_PROFILE
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_secinit.dylib 0x19a7141bc _libsecinit_appsandbox.cold.9 + 84
1 libsystem_secinit.dylib 0x19a713324 _libsecinit_appsandbox + 2080
2 libsystem_trace.dylib 0x18c2326cc _os_activity_initiate_impl + 64
3 libsystem_secinit.dylib 0x19a712ab0 _libsecinit_initializer + 80
4 libSystem.B.dylib 0x19a72a32c libSystem_initializer + 280
5 dyld 0x18c162efc invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 444
6 dyld 0x18c19f864 invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 324
7 dyld 0x18c1bf58c invocation function for block in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const + 240
8 dyld 0x18c1bc318 mach_o::Header::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const + 208
9 dyld 0x18c1bda58 mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const + 124
10 dyld 0x18c19f334 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 516
11 dyld 0x18c162cb4 dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 176
12 dyld 0x18c16e530 dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const + 44
13 dyld 0x18c1848b0 dyld4::APIs::runAllInitializersForMain() + 88
14 dyld 0x18c147e00 dyld4::prepare(dyld4::APIs&, mach_o::Header const*) + 3092
15 dyld 0x18c1471d8 dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operator()() const + 236
16 dyld 0x18c146b4c start + 6000
I suspect this might be due to the provisioning profile, which doesn’t seem to include the required entitlement. However, I haven’t found a way to explicitly add this entitlement to the provisioning profile.
My questions are:
How can I add com.apple.security.device.usb to the provisioning profile?
Is there a way to confirm that adding this entitlement would resolve the issue?
Are there recommended steps to debug and test Virtualization framework usage in a sandboxed environment (especially when launched as a service)?
I also tried disabling SIP and AMFI, but the crash still occurs. Is there a better way to work around or test this in development?
Any insights or suggestions would be greatly appreciated!
Topic:
Developer Tools & Services
SubTopic:
Developer Forums
Tags:
Entitlements
Provisioning Profiles
Virtualization
Hello,
According to the official documentation, the macOS Virtualization Framework currently supports only macOS and Linux guest operating systems. I would like to know if there is any way—officially or through a supported workaround—to run Windows 11 as a guest using this framework.
Additionally, is there any indication or roadmap suggesting that support for Windows guests might be introduced in a future release, such as in macOS 16?
Any insights or official clarification would be greatly appreciated.
Thank you.
Hello,
I'm developing a macOS application that uses the Virtualization framework to run Linux virtual machines (specifically Ubuntu and Fedora) on Apple Silicon Macs.
I've noticed that while the macOS host properly supports all trackpad gestures, the two-finger tap gesture for right-click does not work within the Linux guest. Only the primary click is recognized. This behavior is consistent across different Linux distributions and desktop environments (GNOME, KDE, etc.).
I would like to confirm:
Is the macOS Virtualization framework expected to support trackpad gestures such as two-finger tap for right-click within Linux guest VMs?
If not currently supported, is there a known workaround to enable right-click functionality for the trackpad in Linux guests? (e.g., configuration changes in the VM, Linux kernel input modules, or framework-level adjustments.)
Any insights or suggestions would be greatly appreciated.
Thank you!
I’ve developed a virtual machine manager application using the macOS Virtualization framework. The application currently supports both NAT and bridged networking configurations.
I’m now looking to implement host-only networking, where the guest VM can communicate with the host but not with external networks. Is this networking mode supported by the Virtualization framework, and if so, what is the recommended approach to set it up?
Additionally, I would like to implement port forwarding from the host to the guest (e.g., redirecting traffic from a specific port on the host to a port on the guest). Is there a way to configure port forwarding using the built-in APIs of the Virtualization framework, or would this require a custom networking solution?
Any guidance or best practices for implementing these features within the constraints of the framework would be greatly appreciated.
Hi,
been exploring macOS VM on both Parallels and UTM and they lack some "GPU/graphics" things vs native MacOS which could be useful on some situations (testing some non trusted graphics apps on a Mac VM) so providing similar usefulness as Windows Sandbox..
Current limitations:
1)In MacOS VM night mode doesn't work..
2)HDR support isn't exposed even when enabling HDR on host
3)missing GPTK support for the Paravirtual GPU (Paravitual GPU supports Metal but isn't enough for GPTK to work which complains about unsupported GPU)..
4)OpenCL is supported but only the CPU device.. so expose GPU device in addition to current CPU only device..
5)OpenGL only supports the software renderer.. I assume OpenGL driver on Apple M1-4 GPUs being Metal based, and being Metal supported no reason for software renderer only
thanks..
Hi,
REQUEST 1:
seems Microsoft is ahead of Apple in X86 ARM emulation support at least in features supported..
see:
https://blogs.windows.com/windows-insider/2024/11/06/announcing-windows-11-insider-preview-build-27744-canary-channel/
x64 emulated applications through Prism will now have support for additional extensions to the x86 instruction set architecture. These extensions include AVX and AVX2, as well as BMI, FMA, F16C
BMI1/2 and F16C aren't yet supported by Rosetta.. would be useful for games like Alan Wake 2..
so asking for Rosetta equaling features to Prism emulator..
REQUEST 2:
there is no way to currently enable AVX1/2 on Rosetta Linux..
on macOS using
export ROSETTA_ADVERTISE_AVX=1
does the trick.. but not on Linux VM's.. tested setting this via:
/bin/launchctl setenv ROSETTA_ADVERTISE_AVX 1
on Mac before VM launch and inside Linux VM but AVX2 isn't exposed..
Hi,
Since recently there is interest in having faster x87 translation speeds than Rosetta offers.. mainly some old PC games getting stuck at less than 5fps using Wine that uses Rosetta..( some world of warcraft game for ex.)..
so main case right now, is games using old fmodex library versions (dll or statically)that uses heavy x87 instructions for audio processing , and such games not being threaded ,stalls the render threead, which is the same thread..
Luckily there is a hack, see:
https://github.com/Lifeisawful/rosettax87
”This is an experimental project that modifies Apple's Rosetta technology to use less precise but significantly faster x87 instruction handlers. The benchmarks show approximately 4-5x performance improvement for x87 floating-point operations.”
but limitations are:
1)it runs only on specific Mac version (15.4.1) due to searching some
fixed offsets in current rosetta library that may change with mac updates..
2)requires to run two binaries (a server and the launcher program)..
3)currently doesn’t seem to accelerating x87 instruction on Linux programs/binaries i.e. lacking support for Rosetta on Linux
if Apple supports similar technology, it could providing some enviroment variable like ROSETTA_FAST_X87 for enabling/disabling this fast emulation similar to how Rosetta AVX support not enabled by default..
thanks..
Hi,
I'm trying save and restore features of VZ Framework with saveMachineStateTo and restoreMachineStateFrom(vzvmsaveFilePath) with completionHandler.
Saving feature works well without any errors, .vzvmsave file created on my local mac, but the problem occurs on restore.
After creating VM with the same volume mounts I used to make .vzvmsave, restoreMachineStateFrom method sends error.
Failed to load VM from .vzvmsave file with Error Domain=VZErrorDomain Code=12 UserInfo={NSLocalizedFailure=<private>, NSLocalizedFailureReason=<private>}
Because Localized Failure and its reason are both 'private', I cannot get what exactly happened to this VM app.
Only thing I know here is the Code of VZError but nobody summarized what exactly the error code means.
Could anyone give me the list of VZError code list please?
Hey there! I’ve got some exciting news about Apple’s virtio_net_hdr implementation on macOS 15.4. It’s making communication a lot smoother, with a noticeable improvement!
Now, I’d love to hear your thoughts on a couple of things. First, how do you think we can validate the populated values? And secondly, should we consider reusing populated values for the other endpoint, like the ‘flags’ field?
Your insights would be invaluable!
I am using macOS virtualization farmework and able to create nad and run VMS. I need to resize the disk images using hdiutil in app sandbox environment. Is that possible? i tried disabling sandbox and it worked ok. But with sandbox i get the error message device is not configured. If this cant be done in sandbox what could be the alternative way to to achive this in sandboxed app.
thanks
I have developed an app to create and run virual machines using mac os virtualization framework for apple siicon and intel macs. I have tried ubuntu, fedora, debian & linux mint distros and they all worked fine with intel macs. But when i try to run other distros like mx linux, manjaro, pop os, endevour os etc on intel mac they all on booting iso just shows the black screen. is there any list of officilay support linux distros for intel macs and apple silicon. the support of linux distros are fairly limited or am i missing something.
Works:
runs-on: ubuntu-24.04-arm
container:
image: ubuntu:latest
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- run: |
apt-get --assume-yes update
apt-get --assume-yes install linux-image-generic dracut binutils
- run: |
dracut --conf $(mktemp) \
--confdir $(mktemp --directory) \
--verbose \
--modules "base bash" \
--add-drivers "virtio-rng bcachefs btrfs virtiofs overlay xfs" \
--kernel-cmdline "console=hvc0" \
--no-early-microcode \
--no-hostonly \
--no-compress \
--no-uefi \
initramfs \
$(ls /lib/modules/)
- run: |
cp /boot/vmlinuz-$(ls /lib/modules/) vmlinuz
- uses: actions/upload-artifact@v4
with:
path: |
vmlinuz
initramfs
Will NOT work:
runs-on: ubuntu-24.04-arm
container:
image: ubuntu:latest
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- run: |
apt-get --assume-yes update
apt-get --assume-yes install linux-image-generic-64k dracut binutils
- run: |
dracut --conf $(mktemp) \
--confdir $(mktemp --directory) \
--verbose \
--modules "base bash" \
--add-drivers "virtio-rng bcachefs btrfs virtiofs overlay xfs" \
--kernel-cmdline "console=hvc0" \
--no-early-microcode \
--no-hostonly \
--no-compress \
--no-uefi \
initramfs \
$(ls /lib/modules/)
- run: |
cp /boot/vmlinuz-$(ls /lib/modules/) vmlinuz
- uses: actions/upload-artifact@v4
with:
path: |
vmlinuz
initramfs
You can try it on Github Actions
Using VZVirtioFileSystemDeviceConfiguration allows a Linux guest OS to access folders on macOS. However, modifications to the file's uid/gid by the Linux guest OS have no effect, and the file's uid/gid will always appear as the uid/gid of the Linux user currently accessing the file, as if the uid/gid were not stored at all.I hope there’s a way to at least pass through the uid/gid without any mapping.