macosvm
macosvm copied to clipboard
"--mac" parameter is not in the list of "multi_options", address gets interpreted as a json
I've been trying to use the --mac <addr> parameter and I think it's misconfigured:
~/Desktop/macosvm --version
macosvm 0.2-1
Copyright (C) 2022 Simon Urbanek
There is NO warranty.
Licenses: GPLv2 or GPLv3
Capabilites: macOS guest, vol, vol:automount, net:unix:mtu, usb
~/Desktop/macosvm -g --mac 8e:e0:62:8a:1d:e2 --vol ~/Desktop/sharedWithVM,automount ~/Desktop/macos_13.6/vm.json
2023-10-20 15:39:35.903 macosvm[1374:8455] Cannot open '8e:e0:62:8a:1d:e2': Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
2023-10-20 15:39:35.904 macosvm[1374:8455] ERROR: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
From digging around in the code, I believe the issue here is that --mac isn't included in the list of multi_options.
https://github.com/s-u/macosvm/blob/f133574d3ca34c9c0dd5b5abd12f1f786be69ae3/macosvm/main.m#L364-L366
As a result the parameter to --mac gets read as an file path and assumed to be the path to configuration json, which can be seen if I move the arguments around:
~/Desktop/macosvm -g --vol ~/Desktop/sharedWithVM,automount ~/Desktop/macos_13.6/vm.json --mac 8e:e0:62:8a:1d:e2
ERROR: configuration path can only be specified once
If I add --mac to the list of multi_options and recompile, it works:
~/Desktop/macosvm_3 -g --mac 8e:e0:62:8a:1d:e2 --vol ~/Desktop/sharedWithVM,automount ~/Desktop/macos_13.6/vm.json
2023-10-20 15:52:15.071 macosvm_3[1426:11489] entered setPrimaryMac
2023-10-20 15:52:15.071 macosvm_3[1426:11489] entered setPrimaryMac if
2023-10-20 15:52:15.071 macosvm_3[1426:11489] entered setPrimaryMac if if
2023-10-20 15:52:15.113 macosvm_3[1426:11489] Creating instance ...
2023-10-20 15:52:15.113 macosvm_3[1426:11489] <VMSpec: 0x131f047a0> - configure for run, OS: macos
2023-10-20 15:52:15.113 macosvm_3[1426:11489] + NAT network
2023-10-20 15:52:15.113 macosvm_3[1426:11489] + network: ether 8e:e0:62:8a:1d:e2