# Install the CLI

> Install oatmilk with one command, npm, a standalone binary or from source, and keep it up to date.

Source: https://app.getoatmilk.com/docs/terminal/install

The CLI is one file with no dependencies to install. Its command is `oatmilk`.

## Before you start

- **Node.js 22 or newer**, unless you use a standalone binary. Check with `node --version`.
- **A terminal at least 80 columns wide** for the full-screen app. Headless commands work anywhere, including CI.
- **An Oatmilk account**, on the hosted Oatmilk or [your own installation](https://app.getoatmilk.com/docs/self-hosting.md).

## Install it with one command

On macOS and Linux:

```bash
curl -fsSL https://getoatmilk.com/install.sh | sh
```

The script checks for Node.js 22, downloads `oatmilk`, checks it against the SHA-256 that getoatmilk.com publishes beside it, puts it in `~/.oatmilk/bin` and adds that folder to your shell's `PATH`. Open a new terminal and run `oatmilk`. An install made this way [updates itself](#update).

| Setting | Does |
| --- | --- |
| `OATMILK_INSTALL_DIR` | Installs somewhere other than `~/.oatmilk` |
| `OATMILK_NO_MODIFY_PATH=1` | Leaves your shell's startup files alone |

On Windows, use npm (below).

## Try it without installing

`npx` downloads the latest version and runs it. Nothing stays installed apart from npm's cache.

```bash
npx @getoatmilk/cli --version
npx @getoatmilk/cli
```

Put `npx @getoatmilk/cli` wherever these guides write `oatmilk`.

## Install it with npm

```bash
npm install -g @getoatmilk/cli
oatmilk --version
```

Other package managers work the same way:

```bash
pnpm add -g @getoatmilk/cli
yarn global add @getoatmilk/cli
bun add -g @getoatmilk/cli
```

> [!TIP]
> If your shell says `oatmilk: command not found` after installing, npm's global folder isn't on your `PATH`. `npm prefix -g` prints the folder; add its `bin` folder (on Windows, the folder itself) to `PATH`, then open a new terminal.

## Standalone binaries

Each CLI release on GitHub has binaries that don't need Node.js, for people with access to the Oatmilk repository:

| Computer | File |
| --- | --- |
| Mac with Apple silicon | `oatmilk-darwin-arm64` |
| Mac with an Intel processor | `oatmilk-darwin-x64` |
| Linux on x64 | `oatmilk-linux-x64` |
| Linux on ARM | `oatmilk-linux-arm64` |
| Windows | `oatmilk-windows-x64.exe` |

Download the file for your computer and `SHA256SUMS` from the same release, then check it and put it on your `PATH`:

```bash title="macOS or Linux"
sha256sum --check --ignore-missing SHA256SUMS   # on macOS: shasum -a 256 --check --ignore-missing SHA256SUMS
chmod +x oatmilk-linux-x64
sudo mv oatmilk-linux-x64 /usr/local/bin/oatmilk
oatmilk --version
```

On macOS, if the system refuses to open a downloaded binary, allow it in **System Settings › Privacy & Security**, or run `xattr -d com.apple.quarantine /usr/local/bin/oatmilk`.

## From source

If you have Oatmilk's source, for example to [self-host it](https://app.getoatmilk.com/docs/self-hosting.md), you can build the CLI from the same checkout. You need [Bun](https://bun.sh) and Node.js 22 or newer.

```bash
bun install
bun run build:cli                    # writes packages/cli/dist/oatmilk.js and checks it runs
node packages/cli/dist/oatmilk.js --version
npm install -g ./packages/cli        # optional: makes oatmilk a command
```

Run `bun run build:cli` again after pulling changes.

## Check that it works

```bash
oatmilk --version
oatmilk --help
oatmilk whoami        # exits with code 3 and a hint until you sign in
```

Next, [sign in](https://app.getoatmilk.com/docs/terminal/sign-in.md).

## Update

```bash
oatmilk update            # installs the newest version the way oatmilk was installed
oatmilk update --check    # only says whether there is one
```

When a new version is out, the app shows it at the top right, like `↑ 0.3.0 ⌃U`. Press `⌃U` (or type `/update`) to install it; restart `oatmilk` to use it. An install made with `install.sh` updates itself in the background instead, and tells you when it has. The app checks at most every 12 hours, never slows its start, and never checks in CI.

Choose how it updates, here or under **Settings › Updates** in the app:

```bash
oatmilk update auto      # update by itself (the default)
oatmilk update notify    # only tell me
oatmilk update off       # never check
```

An npm, pnpm, Yarn or Bun install is updated with the same package manager, for example `npm install -g @getoatmilk/cli@latest`. `npx @getoatmilk/cli@latest` always runs the newest version. A standalone binary is updated by downloading the new one.

## Uninstall

Sign out first, so the sign-ins it saved are revoked, then remove it and its files:

```bash
oatmilk logout --all
npm uninstall -g @getoatmilk/cli             # or, for install.sh: rm -rf ~/.oatmilk
rm -rf ~/.config/oatmilk ~/.cache/oatmilk    # macOS also: ~/Library/Caches/oatmilk
```

On Windows, the folders are `%APPDATA%\oatmilk` and `%LOCALAPPDATA%\oatmilk`. The [command reference](https://app.getoatmilk.com/docs/terminal/commands.md#files-it-keeps) lists everything the CLI saves.
