# Machines

> Your desk has a Linux computer that is always there, Windows when you need it and a clean Mac for each Mac job. Machines sleep when idle and count nothing asleep.

The machines of a desk reach each other by name on the desk network (linux.desk, windows.desk, mac.desk). Files stay between sessions.

| Machine | What it is | Shell and home | Starts in |
| --- | --- | --- | --- |
| Linux | Linux, 2 vCPU, 2 GB RAM; large: Linux, 4 vCPU, 8 GB RAM | bash, `/desk` | about 6 s, 3 s from sleep |
| Windows | Windows Server 2025, 2 vCPU, 8 GB RAM | PowerShell 7, `C:\desk` | about 142 s the first time, 23 s from sleep |
| Mac | macOS 26.2, Apple M4, 5 vCPU, 8 GB RAM, a fresh one for each job | zsh | a few seconds, plus its tools |

## Run a command

```sh
maindesk run -- uname -a
maindesk run --on windows -- Get-Date
```

The CLI prints the command's output and exits with its exit code. A sleeping machine wakes for the call.

## Linux

Linux is always there. It comes in two sizes. Switch with `maindesk size large` or `POST /v1/size`. Only `/desk` moves when you switch; programs installed outside `/desk` and running jobs do not.

## Windows

Add Windows from the desk page, or run a command with `--on windows`. Browsers called by name (`msedge`, `chrome`) run as the machine's desk user; other programs that need a user run inside `as-desk { ... }`.

> [!WARNING]
> A Windows sleep is a restart. Running jobs end when Windows sleeps.


## The Mac

Mac work runs as Mac jobs: $0.06 a minute while a job runs on a clean Mac, nothing between jobs. Each job starts a fresh macOS machine, copies your folder in, runs one command, copies the files you name back and deletes that machine, so nothing stays between jobs.

From the CLI:

```sh
maindesk mac job --from /desk/app --get 'build/**/*.app' -- xcodebuild -scheme App -sdk iphonesimulator build
maindesk logs <id> -f
```

From an agent (MCP):

```text
mac(action="job", cmd="xcodebuild -scheme App -sdk iphonesimulator build", from="linux:/desk/app", results=["build/**/*.app"])
job(job_id)
```

The results land on the Linux desk in `/desk/.maindesk/mac-jobs/<id>/`, with `job.log` (the output) and `exit_code` next to the files you named. Jobs that find no free Mac wait in line.


## Sleep and wake

Machines sleep after 10 idle minutes. The next command wakes them. Put them to sleep yourself:

```sh
maindesk sleep --on all
```

From the API: `POST /v1/save` with `"on": "all"`.

## Files

Browse the files on any machine from the web page. From the CLI:

```sh
maindesk get windows:C:\desk\out.txt
maindesk cp linux:/desk/app windows:C:\desk\app
maindesk push
```

`get` downloads one file, `cp` copies between machines and `push` sends the folder you are in to `/desk/<folder name>`. From the API: `GET /v1/files`, `GET /v1/files/content`, `PUT /v1/files/content` and `POST /v1/files/copy`.

## Previews

A web server on a Linux or Windows port gets an HTTPS link through the desk:

```sh
maindesk preview 8080
```

The server must listen on `0.0.0.0`. The link lasts 24 hours unless you pass `--hours`. Anyone with the link can open it while the machine is awake. From the API: `POST /v1/preview`.

## Next steps

- [Plans and desk minutes](/docs/money): what each machine counts
- [CLI commands](/docs/cli): every command in one place
- [API: Machines](/docs/api/machines) and [API: Files](/docs/api/files)
