Virtualization

RSS for tag

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

Posts under Virtualization tag

51 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

detecting if my process is running on a virtual macos x instance and not on my local mac machine
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?
3
1
1.3k
Oct ’23
Sending events to VZVirtualMachineView
I'm trying to send various user input events to a virtual machine. The app is built in SwiftUI, so the VZVirtualMachineView is part of a view controller wrapped in NSViewControllerRepresentable. Non-modified keystrokes and mouse clicks work fine, but I can't send modified keystrokes (e.g., ⌘F). These come through without the modifier (e.g., plain F). I also haven't been able to get mouse scroll wheel events to do anything in the VM. I installed a local event monitor with addLocalMonitorForEvents(matching:handler:). Before the VM boots and the VM view exists, typing myself generates events that I see with the monitor. After the VM boots, though, the monitor does not see any of my keystrokes. The monitor never sees any of my programmatically generated events. I am sending these all through NSWindow.sendEvent(_:). Is there anything special about VZVirtualMachineView that might affect how it handles injected events? It's obvious possible (likely) that I'm doing something wrong with how I build and/or send these events into the application. Can anyone point me to documentation or examples that aren't easily found through search engines?
1
0
97
1d
Can't enroll in 15.1 beta in VM after signing into iCloud
I have created an Apple silicon macOS Sequoia VM using UTM on my Mac also running macOS Sequoia. As noted in the documentation, I can now sign-in to iCloud in the VM. I want to update the VM to macOS Sequoia 15.1 beta. (I understand that Apple Intelligence won't be available in the VM. I need to test my software.) However, when I go to Software Update in the System Settings, I am not offered the opportunity to enroll in the beta. (The "Beta Updates" section never appears.) Is this intentional?
0
1
228
3w
macOS Sequoia 15.1 Beta 2 fails to install as Virtual Machine using Apple's "RunningMacOSInAVirtualMachineOnAppleSilicon" sample project
Every time I attempt to install the macOS Sequoia 15.1 Beta 2 IPSW (UniversalMac_15.1_24B5024e_Restore.ipsw) it fails with the following error in installWithCompletionHandler: Error Domain=com.apple.MobileDevice.MobileRestore Code=3194 "Declined to authorize this DFU file on this device for this user." UserInfo={NSLocalizedDescription=Declined to authorize this DFU file on this device for this user., NSLocalizedFailureReason=Bei der Installation ist ein unbekannter Fehler aufgetreten.} I'm running macOS Sonoma 14.6.1, tried with both MobileDevice.pkg from Xcode 16 beta installed and with the official Device Support for macOS 15 beta installed. In either cases it fails with the same error. The upgrade also fails within a VM for both macOS Sequoia 15.0 Beta 7 and macOS Sequoia 15.1 Beta 2. After pressing Update Now in System Settings › General › Software Update the VM restarts and shows a crash report which unfortunately doesn't contain any useful info (and can't be sent since Apple ID login is only supported with a macOS 15 host...) Anyone know how to solve this?
4
0
815
Aug ’24
Multiple Resolutions in one Virtual Machine
Hi team, I was trying to launch Virtual machine on MacOS 14 using native framework with different Resolutions. let graphicsConfiguration = VZMacGraphicsDeviceConfiguration() graphicsConfiguration.displays = [ VZMacGraphicsDisplayConfiguration(widthInPixels: 2700, heightInPixels: 2200, pixelsPerInch: 100), VZMacGraphicsDisplayConfiguration(widthInPixels: 1920, heightInPixels: 1200, pixelsPerInch: 80) ] return graphicsConfiguration } But I'm getting below error: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=VZErrorDomain Code=2 "More than one display is configured." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=More than one display is configured.} Please let me know it is possible to have multiple resolutions in single VM or not. My use case is to get support of multiple resolutions like 1920x1080, 2048x1536, 1024x728 etc. Thanks.
4
0
342
Sep ’24
Virtualization framework time out of sync
When running Linux in a VM, if I close the lid of my macbook, when I reopen it, for exemple, two hours later, the Linux VM time has "drifted" and is two hours in the past. https://developer.apple.com/documentation/virtualization/running_linux_in_a_virtual_machine Microsoft solves this issue on their Hypervisor with a RTC device /dev/ptp_hyperv, and configuring chrony to use it, see https://learn.microsoft.com/en-us/azure/virtual-machines/linux/time-sync#chrony Linux KVM do the same : https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/chap-kvm_guest_timing_management#sect-KVM_guest_timing_management-Host-guest-time-sync It seems there is also a virtio_rtc module coming Virtualizing macOS on macOS has AppleVirtualPlatformRTCPlugin setting time on the guest. But how to get a Linux time in sync with
3
0
345
Jul ’24
Xcode 16 can't target RealityKitContent on macOS 14?
I'm working on a multi-platform app (macOS and visionOS for now). In these early stages it’s easier to target the Mac, but I started with a visionOS project. One of the things the template creates is a RealityKitContent package dependency. I can target macOS 14.5 in Xcode, but when it goes to build the RealiityKitContent, I get this error: error: Building for 'macosx', but '14.0' must be >= '15.0' [macosx] info: realitytool ["/Applications/Xcode-beta.app/Contents/Developer/usr/bin/realitytool" "compile" "--platform" "macosx" "--deployment-target" "14.0" … Unfortunately, I'm unwilling to update this machine to macOS 15, as it's too risky. Running macOS 15 in a VM is not possible (Apple Silicon). This strikes me as a bug, or severe shortcoming, of realitytool. This was introduced with visionOS 1.0, and should be able to target macOS < 15. It's not really reasonable to use Xcode 15, since soon enough Apple will require I build with Xcode 16 for submission to the App Store. Is this a bug, or intentional?
2
1
403
Jul ’24
Rosetta 2 in MacOS VM
I'm running a MacOS15 beta 3 VM on a MacOS15 beta 3 Host (M2 Pro Mac Mini) using the Apple Virtualization Framework (via https://github.com/s-u/macosvm). For building my app inside the VM I need Rosetta 2, since flutter still uses some Intel binaries. But when I want to install Rosetta 2 I'm always getting the message, that installing Rosetta 2 is not allowed on this system. Digging in the log files I found a message from the installer, that the system is not supported. Searching online I just find a method for using Rosetta 2 inside Linux VM's using the Virtualization Framework. Am I missing something or is it not possible to use Rosetta 2 with MacOS guests?
2
0
599
Jul ’24
Example Virtualization fails with Error Domain=VZErrorDomain Code=1
Hey im trying this example: https://developer.apple.com/documentation/virtualization/running_linux_in_a_virtual_machine And downloaded the vmlinuz and initrd.img from here https://download.fedoraproject.org/pub/fedora/linux/releases/40/Everything/aarch64/os/images/pxeboot but when trying to run i get this error: The output of: file vmlinuz is PE32+ executable (EFI application) Aarch64 (stripped to external PDB), for MS Windows I tried to uncompress with gunzip but this did not work if found this but this did not help eitehr https://developer.apple.com/forums/thread/709539
2
0
347
Jul ’24
Virtual serial ports
Hello, I want to add virtual serial ports to a macOS VM (host = Sonoma, guest = Sonoma). Here is what I tried so far: option 1 I create a VZVirtioConsoleDeviceConfiguration and I add a port to it, with a VZFileHandleSerialPortAttachment connected to two pipes: let consoleDeviceConfiguration = VZVirtioConsoleDeviceConfiguration() let guestPort = VZVirtioConsolePortConfiguration() guestPort.isConsole = false guestPort.name = "myserialport" let guestToHostPipe = Pipe() let hostToGuestPipe = Pipe() guestPort.attachment = VZFileHandleSerialPortAttachment( fileHandleForReading: hostToGuestPipe.fileHandleForReading, fileHandleForWriting: guestToHostPipe.fileHandleForWriting ) consoleDeviceConfiguration.ports[0] = guestPort // config is my VZVirtualMachineConfiguration config.consoleDevices = [consoleDeviceConfiguration] Then after the VZVirtualMachine is instantiated, I get the runtime VZVirtioConsoleDevice for my device and I set my service as its delegate. In the guest system, the device is created with the expected name (/dev/cu.myserialport) When I open it (e.g. screen /dev/cu.myserialport 9600), the consoleDevice(_:,didOpen:) delegate method is called as expected. Then I start sending data to hostToGuestPipe.fileHandleForWriting, but I get nothing in my guest system. option 2 Instead of using config.consoleDevices, I add a VZVirtioConsoleDeviceSerialPortConfiguration to config.serialPorts and I use the same scheme as above with a VZFileHandleSerialPortAttachment and two pipes. It works, but: I can't find a way to rename the devices (/dev/cu.virtio, /dev/cu.virtio1, etc) I can't detect when the endpoint is opened/closed. Am I missing something?
3
0
438
Jul ’24
macOS Routing from VMs & Internet Sharing to VPN
My company uses a VPN to provide access to cloud services for development purposes. I am unable to reach these services from VMs or devices using Internet Sharing. In both cases, those instances can reach the Internet just fine. Here is what the routing table looks like for the VPN: 100.20.x.x 100.65.0.1 UGHS utun1 100.21.x.x 100.65.0.1 UGHS utun1 100.64/10 utun0 Uc utun0 100.65/16 100.65.0.1 UGSc utun1 If I add a custom pf rule, I can get the VM packets routed to the VPN: nat from 192.168.66.0/24 to 100.65.0.0/16 -> (utun1) But, inexplicably, a similar rule for 192.168.2.0/24 does nothing. Using Wireshark, I still see packets sent out the default interface, instead of being sent through utun1. Two questions: Why doesn't the routing "just work" in this case? I expected that, after the NAT rules installed by the system are applied, the packets destined for 100.64.0.0/15 would be properly routed without the need for any custom rules. What else should I try, either to gather more data or attempt to fix the routing?
1
0
427
Jun ’24
USB Device Support in Virtualization Framework in macOS Sequoia 15
I was looking through the different Core OS announcements from WWDC24 and stumbled upon documentation for USB Device support in the Virtualization Framework. However, I haven't found any mention about it or the virtualization framework from the event or otherwise. Are there any related release notes, examples or additional material besides the API documentation for the Beta OS?
2
0
581
Jun ’24
install macOS 15 as virtual machine with Virtualisation framework
Has anyone tried to install macOS 15 (24A5264n) from the downloaded restore image with the sample project RunningMacOSInAVirtualMachineOnAppleSilicon on the latest macOS 14.5? I am getting a strange error Fatal error: A software update is required to complete the installation. Installation requires a software update. System also shows this dialogue But when I click install it says that the software is not currently available from the Software Update server. I'm trying with the latest public Xcode 15.4 on an M3 Mac.
5
1
1.2k
Jun ’24
Shared directories configuration not running on macOS virtual machine
When using the sample code included on the Running macOS in a virtual machine on Apple silicon. I am adding the following changes to the swift files: Added to 'MacOSVirtualMachineConfigurationHelper' file: static func createAutomountSingleDirectoryShareDeviceConfiguration() -> VZVirtioFileSystemDeviceConfiguration { let sharedDirectory = VZSharedDirectory(url: directoryURL, readOnly: false) let singleDirectoryShare = VZSingleDirectoryShare(directory: sharedDirectory) // Assign the automount tag to this share. macOS shares automounted directories automatically under /Volumes in the guest. let sharingConfiguration = VZVirtioFileSystemDeviceConfiguration(tag: VZVirtioFileSystemDeviceConfiguration.macOSGuestAutomountTag) sharingConfiguration.share = singleDirectoryShare return sharingConfiguration } Added to 'path' file: let directoryURL = URL(fileURLWithPath: NSHomeDirectory() + "Projects") Added to the 'AppDelegate' file: virtualMachineConfiguration.directorySharingDevices = [MacOSVirtualMachineConfigurationHelper.createAutomountSingleDirectoryShareDeviceConfiguration()] When the above is added and the sample app is run, the following error is shown: macOSVirtualMachineSampleApp/AppDelegate.swift:95: Fatal error: Virtual machine failed to start with Error Domain=VZErrorDomain Code=2 "A directory sharing device configuration is invalid." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=A directory sharing device configuration is invalid., NSUnderlyingError=0x600000c343c0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} On the host device the directory that is being shared is ~/Projects and it does exist. What do I need to change to create the shared directory and have it work? Is there a sample code project for the same configuration that was shown in the demo?
2
0
673
Apr ’24