# Quickstart

Install the CLI, run a session, and merge your first change request.

Canonical page: https://themachine.myapps.ai/docs/quickstart

This page takes you from a fresh terminal to a merged change request (CR).
Every command below is copy-pasteable.

### Install the CLI

Run the install script. It downloads the `machine` command for your OS and puts
it on your `PATH`.

On macOS or Linux:

```sh
curl -fsSL https://themachine.myapps.ai/install | bash
```

On Windows, in PowerShell:

```powershell
irm https://themachine.myapps.ai/install.ps1 | iex
```

Open a new terminal afterwards if `machine` is not found. See
[CLI → Install](/docs/cli#install) for where it installs and how to update or
remove it.

### Sign in

```sh
machine login
```

This opens the Machine website in your browser. One click authorizes the CLI.
After you sign in, `machine login` picks your account and a default
[project](/docs/project) for you.

On a server or in CI with no browser, sign in with an API key instead:
`machine login --token mach_pat_...`. Create the key in the web app under
**Settings → API keys**.

### Create or clone a project

A new account has no projects yet, so `machine login` has none to pick. Run
`machine init` with a name to create your first project. This scaffolds a
project directory on your computer.

```sh
machine init my-app
cd my-app
machine ship
```

`machine ship` creates the project in Machine on its first run, then pushes
your code. Run `machine ship` again any time to sync local changes.

To work on a project that already exists in Machine, clone it instead:

```sh
machine projects clone <project-id>
```

Find `<project-id>` with `machine projects ls`.

### Run a session

```sh
machine sessions new --prompt "Build the login page"
```

This starts a [session](/docs/work/sessions). The agent works in its own
sandbox, on its own branch, so your project is not touched yet.

Attach to the session to watch progress and reply:

```sh
machine sessions chat
```

### Review and merge the change request

When the agent finishes, it opens a change request with a summary and
the exact diff.

```sh
machine cr ls
```

This lists the open CRs in your project. Review the one the agent opened, then
merge it to land the work on your default branch:

```sh
machine cr merge 1
```

Replace `1` with the CR number from `machine cr ls`. Nothing reaches your
project's default branch until you merge.

## Next steps

- [How the pieces fit](/docs/work)
Projects, sessions, and change requests, explained.
- [CLI command reference](/docs/cli)
Every command, flag, and subcommand.
- [The CLI dev loop](/docs/cli#the-dev-loop)
Link a repo, ship code, and manage sessions from your terminal.
