> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opsh.dxu.one/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Opsh with a single curl command. The installer downloads the latest binary, places it in ~/.opsh/bin, and adds Opsh to your shell startup files.

Opsh installs with a single command. The installer fetches the latest release for your platform, places the binary in `~/.opsh/bin`, and adds an auto-start block to your shell configuration files so Opsh launches every time you open a new interactive terminal.

## Prerequisites

* **curl** must be installed (it is available by default on macOS and most Linux distributions)
* A supported platform: macOS (arm64 or x64) or Linux (arm64 or x64)

## Install

Run the following command in your terminal:

```bash theme={null}
curl -fsSL https://opsh.dxu.one/install.sh | bash
```

After the installer finishes, open a new terminal window. Opsh starts automatically.

## What the installer does

<Steps>
  <Step title="Detect your platform and architecture">
    The installer checks your operating system (`uname -s`) and CPU architecture (`uname -m`) to pick the correct binary. Supported combinations are macOS arm64, macOS x64, Linux arm64, and Linux x64.
  </Step>

  <Step title="Fetch the latest release">
    The installer fetches the latest published release and resolves the correct download URL for your platform and architecture.
  </Step>

  <Step title="Download and extract the binary">
    The binary archive is downloaded to a temporary directory and extracted. The `opsh` executable is copied to `~/.opsh/bin/`.
  </Step>

  <Step title="Add auto-start to your shell configuration">
    The installer appends a managed block to the following files if they exist:

    * `~/.zprofile`
    * `~/.zshrc`
    * `~/.bashrc`
    * `~/.bash_profile`

    The block exports `~/.opsh/bin` to your `PATH` and launches `opsh` automatically when you open an interactive shell session.
  </Step>

  <Step title="Open a new terminal">
    Close your current terminal and open a new one. Opsh detects that it is a fresh install and walks you through the initial configuration.
  </Step>
</Steps>

## Post-install: first launch

The first time Opsh starts, it creates a default config at `~/.opsh/config.json` and immediately launches the interactive setup to choose your AI provider and enter your API key. You can re-run this setup at any time:

```bash theme={null}
opsh --init
```

## Environment variables

### Custom install location

By default, Opsh installs to `~/.opsh`. To install to a different directory, set `OPSH_INSTALL_ROOT` before running the installer:

```bash theme={null}
OPSH_INSTALL_ROOT=/usr/local/opsh curl -fsSL https://opsh.dxu.one/install.sh | bash
```

The binary will be placed at `$OPSH_INSTALL_ROOT/bin/opsh`.

### Disable auto-start

The auto-start block added to your shell rc files checks for the `OPSH_DISABLE_AUTO` environment variable. If it is set to any non-empty value, Opsh will not start automatically when you open a new terminal:

```bash theme={null}
export OPSH_DISABLE_AUTO=1
```

You can still run Opsh manually at any time by typing `opsh`.

## Supported platforms

| Platform | arm64 | x64 |
| -------- | ----- | --- |
| macOS    | Yes   | Yes |
| Linux    | Yes   | Yes |
