Request for clipboard support
First of all a very big "THANK YOU" for creating this wrapper to virtualization framework. In fact, this wrapper has good number of features (including changing of screen resolution, storage size, CPU, memory etc...) that I was not able to find in other commercial applications.
When you get a chance, please look at the possibility of sharing the clipboard from the host mac os to guest mac os.
Thank you so much in advance, Guru R.
I appreciate the idea, but the VZ framework itself does not support this, unfortunately. With some luck, Apple may simply add this to the VZ framework in one of the next macOS releases as this would be really easy for them.
In the meantime, it is possible to work around this by writing and installing "guest tools" in the guest OS. One way to do that is to use the virtual socket API to allow communication between the host and guest. macosvm can create a virtual socket that the guess tool can connect to and use this to communicate - one of the possible things to communicate is the pasteboard content which can be acquired by the GUI part of macosvm.
So this requires two pieces: the support in macosvm and a guest tool that has to be installed on in the guest OS. I have started a feature/guest-tools branch that explores the idea, but it will require some more work to implement the clipboard passing.
macOS 13 has introduced clipboard sharing support to the VZ framework, but, unfortunately, this is only intended for Linux guests via the SPICE agent protocol and I'm not aware of any support on macOS guests for this. So we are back to the part where we need to implement guest tools - essentially we need a macOS port of the clipboard part of spice-vdagent in order to use this. So this doesn't actually help, but given the direction maybe macOS 14 will introduce native macOS clipboard sharing...
Bad news: quick test suggests that this doesn't work for macOS guests at all. Even though the device /dev/tty.com.redhat.spice.0 shows up, simply calling open on it aborts the VM with an internal error (macOS 13 host+guest):
VM <VZVirtualMachine: 0x600002150c30> didStopWithError:
Error Domain=VZErrorDomain
Code=1 "The virtual machine stopped unexpectedly."
UserInfo={NSLocalizedFailure=Internal Virtualization error.,
NSLocalizedFailureReason=The virtual machine stopped unexpectedly.}
Easy workaround is to enable screen sharing in macOS, then connect to the VM and you get clipboard sharing.
@benford-servicem8 thanks, yes, correct, that's why I am recommending that approach in the README - I pretty much never use the -g option other than for the initial installation.