> ## Documentation Index
> Fetch the complete documentation index at: https://developer.lofty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the Lofty CLI

> Install lofty-cli and verify the installation.

## Prerequisites

| Requirement | Minimum version | Notes |
| - | - | - |
| **Bun** or **Node.js** | Bun 1.0+ / Node 18.0+ | Bun is recommended (the CLI bundle uses Bun internally). Node.js works via npm install but may require additional setup. |
| npm (or pnpm / yarn) | any recent | For installing the package |
| A Lofty account | — | For API key or OAuth credentials |

> [!NOTE]
>
> The CLI is distributed as an npm package but internally uses Bun. If you only have Node.js, `npm install -g` will work, but some edge cases may require [Bun](https://bun.sh) installed as the runtime.

## Install

```bash theme={null}
npm install -g @loftyai/lofty-cli
```

## Verify installation

```bash theme={null}
# Check version
lofty-cli --version

# Check available commands
lofty-cli --help

# Verify auth is working (after login)
lofty-cli auth status
```

> [!WARNING]
>
> If `lofty-cli: command not found` appears:
>
> * **npm**: Run `npm config get prefix` and add `<prefix>/bin` to your shell `PATH`
> * **nvm**: Make sure your current Node version is active (`nvm use default`)
> * **Windows/PowerShell**: Use `npx lofty-cli` instead, or add the npm global bin to your system PATH

## Upgrade

```bash theme={null}
npm install -g @loftyai/lofty-cli@latest
```

The CLI also performs a lightweight background check at startup and prints a notice when a newer version is available.

## Uninstall

```bash theme={null}
npm uninstall -g @loftyai/lofty-cli
```

Credential files are **not** removed automatically. Delete them manually for a clean slate:

```bash theme={null}
rm -f ~/.config/tokens/lofty-*.txt
rm -f ~/.config/tokens/lofty-*.json
```

| Path | Created by | Contents |
| - | - | - |
| `~/.config/tokens/lofty-session-cache.json` | `auth login-session` | Token URL response |
| `~/.config/tokens/lofty-pkce-cache.json` | `auth login-browser` | Browser OAuth tokens |
| `~/.config/tokens/lofty-oauth-cache.json` | `auth login` | Client credentials tokens |

## Alternative: per-project install

```bash theme={null}
npm install --save-dev @loftyai/lofty-cli
npx lofty-cli --help
```

Useful when different projects need different CLI versions, or in CI without a global install.

## Next steps

> [card] [Authenticate](https://developer.lofty.com/cli/authentication.md)
>
> Required before any API call.

> [card] [Quickstart](https://developer.lofty.com/cli/quickstart.md)
>
> Common end-to-end examples.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.