osmates vm clone
Make a new machine from another, or from one of its snapshots, without copying its disk.
osmates vm clone [<options>] <source> [<name>]The clone gets a new name, MAC address and identity. A running source is cloned as it is now, and keeps running.
With the name alone, the clone is of the template for agents. The first clone that needs the template makes it, a minute or two more.
--ephemeral and --owner-pid together make a machine for the life of a shell. The clone gets none of the source's port forwards.
--preset agent-sandbox makes an ephemeral clone for an agent to work in, on a copy of a folder. Start it, then run osmates workspace push. Its stop takes the workspace's diff.
Clones, templates and sandboxes: https://osmates.com/docs/clone
Examples
osmates vm clone dev dev-test
osmates vm clone dev scratch --ephemeral --owner-pid $$
osmates vm clone dev sandbox --preset agent-sandboxArguments
<source>RequiredThe machine to clone; the template for agents when only the name is given.
A running machine is held while its disk is copied, longer when
osmates vm infosays its disk image is in many pieces. A clone of a template is a machine like any other.<name>The clone's name: lowercase letters, digits and hyphens.
--snapshot <snapshot>A snapshot of the source to clone instead of its current state.
--ephemeralDelete the clone once it stops.
--keep-identifierKeep a macOS source's machine identifier, so Xcode's provisioning UDID stays the same.
Only one machine with that identifier runs at a time.
--owner-pid <owner-pid>Stop the clone once this process exits.
--clipboard <clipboard>How the clipboard meets the Mac's: off, to-guest, to-mac or both. Default: the source's.
One of
off,to-guest,to-mac,both.--preset <preset>Settings the clone takes together: agent-sandbox.
agent-sandbox makes an ephemeral clone with no shares and the clipboard off, and keeps a Windows or macOS screen on and unlocked while idle. Its network is never open. The clone of an open source reaches package registries, GitHub and AI model APIs. The clone of a limited source keeps its rules, minus those that reach this Mac or a local network. --egress and --allow set others. The clipboard, shares and network can't be opened later.
One of
agent-sandbox.--egress <egress>The clone's network access: open, allowlist or blocked. Default: the source's.
One of
open,allowlist,blocked.--allow <rule>RepeatableA destination the clone's allowlist allows; repeat for more.
--jsonPrint machine-readable JSON.
JSON output
With --json, it prints an object with these fields.
JSON Schema: /schemas/0/cli/vm/clone.json
acceleratedGraphicsbooleanaccountobjectRequiredaccount.authorizedKeysarray of stringsRequiredaccount.enablesRemoteLoginbooleanRequiredaccount.userstringRequiredcameraobjectcamera.devicestringcamera.onbooleanRequiredclipboardstringRequiredOne of
off,to-guest,to-mac,both.cpuCountintegerRequiredcreatedAtstring (date-time)Requiredcreatorstringcredentialsarray of objectscredentials[].credentialstring (uuid)Requiredcredentials[].endedobjectcredentials[].expiryobject or stringRequiredOne of
machineStop,never, or an object that holds one key:at.credentials[].grantedAtstring (date-time)Requiredcredentials[].includesClonesbooleanRequiredcredentials[].placeholderstringRequireddataDisksarray of objectsdataDisks[].filestringRequireddataDisks[].fromstringRequireddataDisks[].sizeintegerRequiredAt least 0.
discstring (uri)diskBusstringOne of
nvme.diskSizeintegerRequiredAt least 0.
displayobjectdisplay.heightintegerRequireddisplay.pixelsPerInchintegerdisplay.scaleintegerRequireddisplay.widthintegerRequireddisplayCountintegeregressobjectegress.modestringRequiredOne of
open,allowlist,blocked.egress.rulesarray of stringsRequiredenginestringRequiredOne of
virtualization,hypervisor.firmwareobjectfirmware.sha256stringRequiredfirmware.versionstringRequiredfirstAgentAnswerstring (date-time)forwardsarray of objectsforwards[].gueststringRequiredforwards[].guestPortintegerRequiredAt least 0.
forwards[].hostPortintegerRequiredAt least 0.
forwards[].transportstringRequiredOne of
tcp,udp.highDynamicRangebooleanidstring (uuid)Requiredimportedobjectimported.bitLockerbooleanRequiredimported.formatstringRequiredOne of
vmdkSparse,vmdkFlat,vmdkSplitSparse,vmdkSplitFlat,vmdkStream,vmdkVMFS,hddExpanding,hddPlain,qcow2,raw,asif.imported.fromstringRequiredimported.identitystringRequiredOne of
kept,new.imported.leftBehindarray of objects or stringsRequiredEach item is one of
firmwareVariables,guestTools,appSettings, or an object that holds one key:tpm,snapshots,savedStatesorotherDisks.imported.systemstringRequiredOne of
linux,macOS,windows,freeBSD.isEphemeralbooleanRequiredkeepsMacAwakebooleanlastBuildobjectlastBuild.enginestringlastBuild.signaturestringRequiredlastBuild.versionstringRequiredmacOSobjectmacOS.listedAtstring (date-time)macOS.offerobjectmacOS.reportedAtstring (date-time)RequiredmacOS.versionstringRequiredmacOS.wayBackobjectmemorySizeintegerRequiredAt least 0.
namestringRequirednestedVirtualizationbooleannetworkobjectHolds one key:
natorvmnet.network.natobjectnetwork.vmnetobjectoperatingSystemstringRequiredOne of
linux,macOS,windows,freeBSD.originobjectorigin.keptIdentifierbooleanorigin.machinestring (uuid)Requiredorigin.namestringRequiredorigin.sharesAccessbooleanorigin.snapshotstringorigin.templateSincestring (date-time)ownedByRunbooleanownerobjectowner.processIdentifierintegerRequiredowner.startedAtstring (date-time)RequiredpartitionGrowthobjectpartitionGrowth.diskSizeintegerRequiredAt least 0.
partitionGrowth.failuresintegerRequiredpartitionGrowth.problemstringpartitionGrowth.retriesbooleanRequiredpresetstringOne of
agent-sandbox.processorobjectprocessor.clockSpeedintegerRequiredAt least 0.
processor.manufacturerstringRequiredprocessor.midrintegerRequiredAt least 0.
processor.namestringRequiredpulledFromobjectpulledFrom.digeststringRequiredpulledFrom.publisherstringpulledFrom.pulledAtstring (date-time)RequiredpulledFrom.referencestringRequiredpulledFrom.signedBystringrecordingstringOne of
off,on,video,trajectory.requirementsobjectrequirements.cpuCountintegerRequiredrequirements.memorySizeintegerRequiredAt least 0.
rosettabooleansecureBootbooleansecurityKeybooleansharesarray of objectsRequiredshares[].eventsbooleanRequiredshares[].folderstring (uri)Requiredshares[].namestringRequiredshares[].readOnlybooleanRequiredshortcutsstringOne of
mac,pc.snapshotPolicyobjectRequiredsnapshotPolicy.beforeRevertingbooleanRequiredsnapshotPolicy.includesMemorybooleanRequiredsnapshotPolicy.keepintegerRequiredsnapshotPolicy.schedulestringRequiredOne of
never,hourly,daily.soundobjectsound.microphonebooleanRequiredsound.mutedbooleanRequiredsourceobjectsource.buildstringsource.digeststringsource.formatstringOne of
qcow2,raw,asif,xz.source.imagestringRequiredsource.installedOnstringsource.linuxLocaleobjectsource.locationstringsource.macOSLocaleobjectsource.versionstringsource.virtualSizeintegerAt least 0.
source.windowsobjectsource.xcodeobjectstartsAtLoginbooleantemplateSincestring (date-time)usbDevicesarray of objectsusbDevices[].namestringusbDevices[].productIDintegerRequiredAt least 0.
usbDevices[].serialstringusbDevices[].vendorIDintegerRequiredAt least 0.
watchdogbooleanwindowsDriversobjectwindowsDrivers.datestring (date-time)RequiredwindowsDrivers.namestringRequiredwindowsDrivers.resultsarray of objectsRequiredwindowsDrivers.setstringRequiredwindowsDrivers.snapshotstring (uuid)windowsDrivers.snapshotNamestringwindowsDriversUndonestringworkspaceobjectworkspace.bytesintegerRequiredAt least 0.
workspace.commitstringworkspace.filesintegerRequiredworkspace.folderstringRequiredworkspace.guestPathstringRequiredworkspace.historyLeftOutstringworkspace.hooksPathstringworkspace.idstring (uuid)Requiredworkspace.isGitWorkTreebooleanRequiredworkspace.lastDiffobjectworkspace.leftOutarray of objectsRequiredworkspace.objectFormatstringRequiredOne of
sha1,sha256.workspace.outstandingstringworkspace.pushedAtstring (date-time)Requiredworkspace.snapshotsBeforearray of strings (uuid)Required
Fields nested deeper are in the schema.
Exit statuses
Its exit status is one of these.
| Status | Meaning |
|---|---|
| 0 | The command did what it was asked. |
| 1 | The command failed; with --json, standard error's last line is the error object. |
| 64 | The command line is wrong, as ArgumentParser found before the command ran. |
| 65 | What was given is wrong, found while the command ran; the same command fails until it changes. |
| 75 | The same command can work later with nothing changed, as while an update finishes. |
| 130 | Control-C cancelled what the command started. |