# Start, pause, and stop machines

Start and stop machines, and choose what they do when you quit, sleep, log out, or restart your Mac.

## Start a machine

Select the machine in the library, then click **Start**.

```sh
osmates vm start dev
```

Add `--no-window` to start without a window, where screenshots and input still work. Its Dock icon opens the window later.

[OSMates Free](https://osmates.com/docs/editions) runs two machines at once, and Apple allows [two macOS machines](https://osmates.com/docs/macos#run-two-macos-machines-at-once). A third start offers **Wait to Start**, or waits with `--queue`, until a running machine stops. To leave the queue, click **Cancel Start** or run `osmates vm stop`.

## Stop a machine

In the machine's window, choose **Machine > Shut Down**. The guest decides whether to turn off. To cut the power instead, choose **Machine > Force Stop**, which loses unsaved work.

```sh
osmates vm stop dev
```

`vm stop` also asks the guest agent to close apps in Windows and macOS. Windows updates can delay a shutdown, as [Stop Windows](https://osmates.com/docs/windows-use#stop-windows) explains.

Command-Q in a machine's window offers to suspend or shut it down. To answer once for every machine, set **When you quit a machine** in General settings. Quitting OSMates leaves machines running.

When you log out or restart your Mac, machines that can suspend do, and the rest shut down. If you chose to shut down in General settings, every machine shuts down.

## Pause or suspend a machine

A paused machine stops its clock and takes no input, commands, or files. Suspend saves the memory to disk and turns the machine off. It resumes where it was, even after your Mac restarts.

1. Choose **Machine > Pause** or **Machine > Suspend**.
2. To continue, click **Resume**.

```sh
osmates vm suspend dev
osmates vm start dev
```

Suspend needs free space equal to the machine's memory plus 1 GiB. A machine with a [USB device](https://osmates.com/docs/usb) attached can't suspend, nor can Linux with [3D](https://osmates.com/docs/linux-graphics) on, and `vm suspend` says why. To discard saved memory and start from disk, run `osmates vm stop dev --discard`.

When your Mac sleeps, running machines pause. They continue when it wakes, with their clocks reset.

## Keep a machine running while you're away

Requires [OSMates Pro](https://osmates.com/docs/editions#what-pro-adds).

1. Select the machine, choose **Machine > Machine Settings**, then click **Power**.
2. Turn on the settings you want. If you see **Register**, click it.

| Setting | Option of `osmates vm set` | What it does |
|---|---|---|
| Keep This Mac Awake While It Runs | `--keep-awake` | Keeps your Mac awake. Closing the lid, choosing Sleep, or a low battery still puts it to sleep |
| Start at Login | `--start-at-login` | Starts the machine without a window when you log in |
| Restart When Not Responding | `--watchdog` | Restarts the machine when the guest agent doesn't answer for 3 minutes, not counting pauses and sleep |

At login, machines start one at a time, in name order. OSMates skips one that would leave under 4 GiB of memory, would be a third macOS machine, or failed twice. A notification says why.

With FileVault on, your Mac waits at the login screen after a restart. Without it, automatic login and `sudo pmset -a autorestart 1` bring machines back after a power cut.

After 3 restarts in an hour, a machine that doesn't respond stays stopped. `osmates vm events` lists each restart.

Clones keep only Keep This Mac Awake. Temporary machines can't use the other two, and agents can't change them.
