Virtualization

RSS for tag

Create hardware-accelerated virtual machines to run macOS and Linux-based operating systems.

Virtualization Documentation

Pinned Posts

Posts under Virtualization tag

60 Posts
Sort by:
Post not yet marked as solved
0 Replies
767 Views
Hi there-- Ive been trying to recreate an issue with a camera app im developing on a clean install. I can easily start up a new VM with VirtualBuddy, UTM or Parallels but Im having trouble getting a camera device to passthrough. Parallels seems to be the most promising but whenever I try to connect it, there is an error. Does anyone have advice on the best VM provider to use to passthrough usb devices or native cameras? Thanks!
Posted
by
Post not yet marked as solved
3 Replies
925 Views
I've written a native app for macOS on my MacBook Air (with the Apple M2 chip.) Now I need to test it for an Intel-based CPU. When I build my app in Xcode, it is supposed to cover both ARM64 and x86-64 architectures in a single Mach-O binary, but when I send it to my customer he tells me that the app works on the Apple silicon but it crashes on his Intel-based Mac. So I'm looking for ways to test-run my app on an Intel-based platform and see what is wrong there. (But I obviously don't want to buy a separate Mac just for that.) I know that one can use Azure to spin up a Windows, or a Linux VM and open it via a web browser. But it doesn't seem to support macOS. How can I run an Intel-based macOS in a virtual environment? Or, do you have any other suggestions?
Posted
by
Post not yet marked as solved
3 Replies
547 Views
Neat, looks like macOS Sonoma has native virtualisation now. You have to build a Swift app, which is a bit weird, but it works, and on an M1 chip. One thing though... here's a screenshot of the Displays screen in Settings: Curious why these two resolutions were decided. My host screen is 1920 x 1080, so one resolution is far too high, and the other is just a bit too small. Something in between would be nice! Here’s the guide if anyone wants to have a go: https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon You’ll need macOS 14 Sonoma and Xcode 15 beta
Posted
by
Post not yet marked as solved
1 Replies
399 Views
Hi, I'm trying to implement macOS virtualization on the M1 Sonoma mac mini. Configuration: OS- Mac m1 sonoma Build version- 23A5286i ProductVersion- 14.0 Virtulization image- 13.5.2 bulild version IPSW file - /UniversalMac_13.5.2_22G91_Restore.ipsw I'm following the documentation - https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon?language=objc Getting following error while reloading the restore image- MacOSVirtualMachineInstaller.swift:32: Fatal error: The restore image failed to load. Unable to connect to installation service Please help.
Posted
by
Post not yet marked as solved
1 Replies
503 Views
I have a Mac OS virtual machine (VM) on my Macbook Pro with M1 Pro chip. The VM was set up using Xcode and Apple's sample code in https://developer.apple.com/documentation/virtualization. Both the host and the VM have Mac OS 14. The mouse and trackpad scroll direction is reverse to what I am used to so I need to change the natural scroll setting. However mouse and trackpad settings are missing in my VM. Usually, they are under Keyboard (host has them). The pointing device was set up using the default in the sample code: static func createPointingDeviceConfiguration() -> VZPointingDeviceConfiguration { return VZMacTrackpadConfiguration() } I have been using this setup before without a problem. But now I am not able to change the scroll direction. Does anyone know what is going on? Any suggestion will be appreciated.
Posted
by
Post marked as solved
3 Replies
647 Views
I m trying to identify if my launched process is running on a local mac machine(desktop/laptop) or a virtual macOS X instance like AWS EC2, Azure, MacStadium etc. I have followed this link which searched for its limited providers in the output, but I m not bound to any limited providers and looking for a general solution which is applicable to all the providers. Is there some hardware/network/virtualization-related information that can be used to identify if the process is launched on a virtual MacOS instance? OR is there some system Information that I can use to be sure that my process is running on a local machine?
Posted
by
Post not yet marked as solved
4 Replies
479 Views
Im using VZVirtualMahcine with Linux guest system. Every once in a while, for no apparent reason, VM just freezes completely (screen just freezes at current state), and CPU usage of the process on host is using 100%. I need to force quit the app then. This happens even if guest os is just running doing nothing. Anyone else experienced this kind of behavior? It was like that on Ventura, and now also on Sonoma. Xcode 14 and 15.
Posted
by
Post not yet marked as solved
2 Replies
408 Views
I am following example on Apple docs: GUILinuxVirtualMachineSampleApp I am able to create GUI VM first time but from second time onwards it throws error Guest did stop virtual machine. 2023-10-01 20:45:08.991551+0530 GUILinuxVirtualMachineSampleApp[6417:1426889] [client] No error handler for XPC error: Connection invalid Thought some permission error, app cannot access the VM bundle, tried giving all perms, but didn't help, also the error is not specific as to why did guest stop the VM. Please let me know what might be the cause and how to move forward. Deleting VM bundle and restarting works but that's not the solution I am looking forward too.
Posted
by
Post not yet marked as solved
1 Replies
576 Views
I installed Gentoo in virtual machine using Apple Virtualization framework. In linux then I installed avahi, configured the network in Bridge mode. Now I want to connect from this virtual machine to other computer in local network. I can see other computers on the local network, and connect with them using local IP address. But for some reason these are not detected using .local domain. I run avahi-browse -at|grep PS3 and it detected 4 entries for this computer: IPV4 _ssh._tcp local IPV6 _ssh._tcp local IPV4 _sftp-ssh._tcp local IPV6 _sftp-ssh._tcp local Also avahi-resolve -n PS3.local correctly detects IPv6 address of this machine. So why cannot I connect with the computer using PS3.local name?
Posted
by
Post not yet marked as solved
1 Replies
450 Views
I m trying to identify if my launched process is running on a local mac machine(desktop/laptop) or a virtual macOS X instance like AWS EC2, Azure, MacStadium etc. I am using the below check for this: 1 . If running on native Apple hardware, the returned value contains the model name of the hardware: $ sysctl -n hw.model Macmini8,1 On virtualized hardware, the value may contain the hypervisor name: $ sysctl -n hw.model VMware7,0 If the command output doesn't contain the "Mac" substring, the malware considers that it is running in a virtual machine. 2. Checking USB device vendor names The commands used: ioreg -rd1 -c IOUSBHostDevice | grep "USB Vendor Name" Sample output on native Apple hardware: "USB Vendor Name" = "Apple Inc." "USB Vendor Name" = "Apple Inc." "USB Vendor Name" = "Apple, Inc." On virtualized hardware, the value may contain the hypervisor name: "USB Vendor Name" = "VirtualBox" "USB Vendor Name" = "VirtualBox" A virtual machine can be detected by checking if the command output contains a hypervisor name, for example "VirtualBox", "VMware", etc. 3 . Checking the "IOPlatformExpertDevice" registry class The command used: ioreg -rd1 -c IOPlatformExpertDevice The following fields of the IOPlatformExpertDevice class can be checked in order to detect a virtual machine: I wanted to know can a combination of these be used to identify a process running on a Cloud VM with certainity?
Posted
by
Post not yet marked as solved
2 Replies
1k Views
Hello, I am trying to understand how macOS virtualization framework and Virtualization products work on M1 chips. I have tried Parallels Desktop. There are no third party kernel extensions (kext) installed with this product. When i plug an USB device on my mac, i get a popup asking me if i want to plug this device to my host mac or to the current Parallels virtual machine. How can this be possible without kext ? Device management is handled at kernel level... and there are no virtualization framework API for that... I have create a Linux virtual machine with Virtualization framework (similar to GNULinuxVirtualMachineSampleApp project): It works but I don't understand why i can't run Windows Virtual machines. Parallels Desktop seems to work with Virtualization framework too and this product can run ARM Windows Virtual Machine. How can they do that ? Is there a way to simulate key sending with Virtualization framework ? I have create a 64Gb disk (VZDiskImageStorageDeviceAttachment). I have a 64Gb file on my host mac, but i am using only 10Gb on the virtual machine at this moment. Is there a way to optimize the disk image file size ? VZVirtualMachine provides a "pause" method. I don't understand where the virtual machine state (RAM memory, ...) is saved on the host. Thanks a lot
Posted
by
Post not yet marked as solved
2 Replies
319 Views
Can you explain me why it is not possible to work with VZVirtualMachine on iOS ? iPad is working with the same ARM chips than mac. It would be great to create a Linux VM on an iPad pro for example... I am tossing a bottle into the sea... Thanks
Posted
by
Post not yet marked as solved
1 Replies
350 Views
Hi, I am running GUI Linux using Apple provided reference examples.I would like to know if there is api which supports hot plug of devices and visible on my GUI Linux. I see VZDiskBlockDeviceStorageDeviceAttachment in the docs, but here we need to provide the /dev/* to get it visible in the Linux system, Would like to know the dynamic device detection capability api support if any.
Posted
by
Post not yet marked as solved
0 Replies
332 Views
Good day , thank you very much for the #virtualization article I have now managed to create a linux(#debian 12/bookworm) virtual machine I now have the following questions. How can i increase the size of the GUI Linus VM.bundle from 68.72G to 150G? Unable to obtain an IP V4 address to a bridge (have intall brige-utils package) - can get IP v6 address without any problem. my #bridge setup is auto br0 iface br0 inet dhcp bridge_ports enp0s1 bridge-stp on bridge-fd 0 Unable to ping the host from the virtual machine , but able to ping vms from the host - no firewalls are running, how can i enable icmp from vm to host and host to other containers. my target is to run lxd/incus containers to test few of my applications in apple silicon I am now able to run lxd/incus without any problem. however i am not able to access the application that are running in the containers, provided I am logged into the linux vm which beats the purpose of publishing the my apps, few of the services are IBM informix REST API / Nginx . My #requirement is 1, increase the size of the vm image.(#GUI Linux vm.bundle) 2. Obtain #ip address V4 for br0 3. Run #lxd / #incus containers 4. #icmp comms between host / vm / containers Please let me know if there are possibilities to achieve my requirement. Thank you
Posted
by
Post not yet marked as solved
9 Replies
741 Views
We are currently utilizing VZ with Lima (details: Lima VM and VZ) for our development environment. However, we're encountering a critical issue with the com.apple.Virtualization.VirtualMachine process leading to open file handle exhaustion. When mounting our programming languages dependency cache folder (Which can have a lot of files) into the VZ VM, we encounter an operating system error related to open file limits: /gomodcache/github.com/go-git/go-git/v5@v5.4.2/plumbing/object/patch.go:14:2: open /gomodcache/github.com/go-git/go-git/v5@v5.4.2/plumbing/format/diff/unified_encoder.go: too many open files in system Further investigation revealed an abnormally high number of open files associated with the com.apple.Virtualization.VirtualMachine process. A significant portion of these files are not actively used but remain open. Example Case: A file (/Users/rcurrah/test.txt) created on the Mac host and listed (ls) in the VM remains open even 20 minutes later, as evidenced by the following command output: ❯ lsof | grep 11208 | grep test.txt COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME com.apple 11208 rcurrah 4823r REG 1,13 0 46200882 /Users/rcurrah/test.txt Steps to Reproduce the Issue: To reproduce the file handle exhaustion follow the below steps. This process will create a large number of files on the Mac host, listing them on the VZ VM, and then verifying their open status using lsof. Setup the VZ Environment with Sharing: Create a VZ VM with your home directory shared to the VM. Create a Test Directory on the Mac Host: Create a new directory on your Mac host, e.g., mkdir ~/test-file-exhaustion. Generate a Large Number of Files: Navigate to the created directory: cd ~/test-file-exhaustion. Use a loop to create a large number of files, e.g., for i in {1..10000}; do touch "file_${i}.txt"; done. This will create 10,000 files named file_1.txt, file_2.txt, etc. List Files in the VM: Access the VZ VM shell. Navigate to the mounted directory and list the files using the ls command, e.g., ls /path/to/mounted/test-file-exhaustion. Check Open Files on Mac Host: Exit the VM and return to your Mac host terminal. Use the lsof command to check for open files related to the com.apple.Virtualization.VirtualMachine process: lsof | grep "$(pgrep com.apple.Virtualization.VirtualMachine)" | grep 'test-file-exhaustion' | wc -l. Document the Output: Record the output of the lsof command. Note the number of open files. Verify File Closure (or Lack Thereof): After a certain period, e.g., 20 minutes, repeat the lsof command to see if the files are still open, indicating that they haven’t been closed properly by the process. Given these observations, we have a couple of questions: Is this behavior of com.apple.Virtualization.VirtualMachine retaining open file handles a known issue or a bug? Should VZ be managing the closure of these file handles more efficiently, especially when they are no longer in use? This issue is impacting our development workflow significantly. Any guidance or insights on resolving this would be highly appreciated. Thank you for your attention to this matter. Best regards, Ryan
Posted
by
Post not yet marked as solved
3 Replies
470 Views
Hello, I am setting up a Linux virtual machine with Virtualization framework. It works fine. Here is how i am creating a network interface: let network_device = VZVirtioNetworkDeviceConfiguration() network_device.attachment = VZNATNetworkDeviceAttachment() vm_config.networkDevices = [network_device] As you can see, this is a NAT network. I would like to know the IP address assigned to this interface. macOS emulates a DHCP server and i would like to know the IP in my Xcode program. How can i do that ? Thanks
Posted
by
Post not yet marked as solved
1 Replies
300 Views
For some reason when I try to archive an app, which is using saveMachineStateTo function, it fails with this error: Value of type 'VZVirtualMachine' has no member 'saveMachineStateTo' It works fine when running as debug from Xcode. Also fails if I change run destination to release. I have project set to macOS 14. What can cause this?
Posted
by
Post not yet marked as solved
4 Replies
545 Views
Hello, I am working on a macOS Virtualization framework project on Xcode. Is there a way to redirect an USB device connected to the host mac, to a virtual machine. I know this is possible with lower layers but i would like to do it with a VZVirtualMachine object. Is it possible ? Thanks
Posted
by
Post not yet marked as solved
1 Replies
298 Views
Hello I have looked at Virtualization framework samples source code provided by Apple. There is something strange: For a linux guest OS, i can see a variable store: let variableStore = try VZEFIVariableStore(creatingVariableStoreAt: xxxx) ... let bootloader = VZEFIBootLoader() ... bootloader.variableStore = variableStore It seems this variable store is linked with NVRAM. For a macOS guest OS, there is no variable store. (The bootloader is created with VZMacOSBootLoader) My question is why macOS guest doesn't need variable store ? Thanks
Posted
by