Legato

Drive a persistent macOS VM

The MCP client runs on your Mac. OpenSSH carries its requests to a macOS guest on the same machine. Legato runs inside the guest's graphical login, where the OS routes clicks, typing, keyboard shortcuts and drags to guest apps. The VM keeps its apps, files and sign-ins between MCP connections. The whole guest screen is visible to the agent.

Prepare a local guest

  1. On an Apple silicon Mac, create a macOS guest with an Apple Virtualization-based VM manager. In VirtualBuddy, click +, choose macOS, pick a compatible restore image and complete setup. An existing persistent guest also works. Start it, sign into its GUI and leave it unlocked. For the first test use an empty guest account. The fixture needs no personal files, signed-in apps or host shares. Turn off clipboard sharing and Handoff for this test. VirtualBuddy setup
  2. In the guest, enable System Settings → General → Sharing → Remote Login for the guest test account. Configure the host's SSH public key for that account and identify the guest's reachable address. Use a private host-to-guest network. Verify the guest host-key fingerprint on first connection against the fingerprint shown inside the VM. In guest Terminal, run ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub.
  3. On the host, give that connection an alias in ~/.ssh/config. Substitute the guest address and short account name below. If using a dedicated key, include its IdentityFile and set IdentitiesOnly yes.
Host legato-guest
    HostName GUEST_ADDRESS
    User GUEST_USER

Run ssh legato-guest /usr/sbin/sysctl -n hw.model from the host. An Apple silicon macOS guest reports a model such as VirtualMac2,1. Keep Remote Login and guest input permissions scoped to the guest.

Install Legato in the guest

Use native arm64 Python 3.10 or newer in the guest. In guest Terminal, create the environment at ~/.legato-vm. The host starts this interpreter over SSH. Install the same Legato version on the host and in the guest.

python3 -m venv ~/.legato-vm
~/.legato-vm/bin/python -m pip install legatolabs

On the host, check the guest through its alias:

ssh -T -o BatchMode=yes -o StrictHostKeyChecking=yes legato-guest \
    'exec "$HOME/.legato-vm/bin/python" -I -m legato.mac_vm --check'

The preflight checks the machine model, graphical session, Accessibility and Screen Recording in the process context used by this connection. If it reports a missing grant, open Privacy & Security inside the guest, allow the responsible guest executable reported by macOS and reconnect. An SSH session that cannot access the logged-in GUI will fail the check. Success in guest Terminal alone does not verify the SSH connection.

Connect an MCP client

Configure the client to start legato with arguments ["mcp", "--mac-vm", "legato-guest"]. Use desktop_open() for the guest's current screen. Use the same desktop ID for actions across apps. One MCP connection claims that guest's foreground. Disconnect it to give the next client control. You can shut down or resume the VM in its VM manager.

For two agents at once, run two guests and start one server per guest, such as legato mcp --mac-vm legato-guest and legato mcp --mac-vm legato-guest-2. Each agent has its own desktop, keyboard and pointer. Legato does not create guests, split a task between them or copy your sign-ins into them.

Start with the opt-in input isolation test. It exercises a native drag between two guest processes and a keyboard shortcut while you type on the host. The two-guest test repeats it in two guests at once. A VM on Apple silicon is required to validate the actual GUI.

Migrating selected files or installing apps in a guest is a separate setup choice. Apps can ask you to sign in again. Apple's macOS Tahoe license specifies the permitted uses and instance count for virtualized copies in section 2B(iii). Using iCloud with macOS VMs · macOS Tahoe license

Edit this page on GitHub · Markdown