UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Unable to change serial ports using AppleScript

Open ptxmac opened this issue 2 months ago • 0 comments

Describe the issue
I've been unable to get AppleScript to update serial ports of a qemu vm Configuration

  • UTM Version: 4.7.4 (115)
  • macOS Version: 26.0.1
  • Mac Chip (Intel, M1, ...): M2

Script

I believe it should be something like this:

tell application "UTM"
	set vm to virtual machine id "<insert-uuid-here>"
	set config to configuration of vm
	
	-- Get existing serial ports (should work if bug is fixed)
	set currentPorts to serial ports of config
	
	-- Create new serial port
	set newPort to {interface:ptty, port:1, hardware:""}
	
	-- Add new port and update configuration
	set serial ports of config to currentPorts  & {newPort}
	update configuration of vm with config
	
	-- Return results
	return "Added new serial port"
end tell

But it fails with this error. I also tried just a round-trip where I set serial ports to currentPorts and that also fails

Error

error "Can’t set every «class SeRi» of {«class DrSm»:«constant ****SmWv», name:\"vm1-8505\", «class SrPt»:{{«class PoRt»:0, «class InTf»:«constant ****PtTy», «class HaWe»:\"\", index:0}}, «class IcOn»:\"\", «class DiPs»:{{«class HaWe»:\"virtio-ramfb\", index:0, «class DyRe»:true, «class NaRe»:false, «class DoFi»:«constant ****QsLi», «class UpFi»:«constant ****QsNe»}}, «class QeAd»:{}, «class NoTe»:\"\", «class NtIf»:{{«class AdDr»:\"5A:21:8A:78:A4:A7\", «class PtFw»:{}, «class HoIf»:\"\", «class HaWe»:\"virtio-net-pci\", «class MoDe»:«constant ****ShRd», index:0}}, «class DrVs»:{{id:\"FA8210A6-1398-4D1D-A71E-396B3C04766C\", «class ReMv»:true, «class InTf»:«constant ****QdIu», «class HoSz»:1634}, {id:\"8909092F-0F74-4940-A8D4-B4FA9C8A8A25\", «class ReMv»:false, «class InTf»:«constant ****QdIv», «class HoSz»:0}}, «class MaCh»:\"virt\", «class ArCh»:\"aarch64\", «class CpUc»:2, «class UeFi»:true, «class HyPr»:true, «class MeMy»:1024} to {{«class InTf»:«constant VmErPtTy», «class PoRt»:1, «class HaWe»:\"\"}}." number -10006 from every «class SeRi» of {«class DrSm»:«constant ****SmWv», name:"vm1-8505", «class SrPt»:{{«class PoRt»:0, «class InTf»:«constant ****PtTy», «class HaWe»:"", index:0}}, «class IcOn»:"", «class DiPs»:{{«class HaWe»:"virtio-ramfb", index:0, «class DyRe»:true, «class NaRe»:false, «class DoFi»:«constant ****QsLi», «class UpFi»:«constant ****QsNe»}}, «class QeAd»:{}, «class NoTe»:"", «class NtIf»:{{«class AdDr»:"5A:21:8A:78:A4:A7", «class PtFw»:{}, «class HoIf»:"", «class HaWe»:"virtio-net-pci", «class MoDe»:«constant ****ShRd», index:0}}, «class DrVs»:{{id:"FA8210A6-1398-4D1D-A71E-396B3C04766C", «class ReMv»:true, «class InTf»:«constant ****QdIu», «class HoSz»:1634}, {id:"8909092F-0F74-4940-A8D4-B4FA9C8A8A25", «class ReMv»:false, «class InTf»:«constant ****QdIv», «class HoSz»:0}}, «class MaCh»:"virt", «class ArCh»:"aarch64", «class CpUc»:2, «class UeFi»:true, «class HyPr»:true, «class MeMy»:1024} to «class 2eld»

ptxmac avatar Oct 18 '25 20:10 ptxmac