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

# Install golain

> Install the golain CLI from the Golain CDN or build from source.

**golain** is the official Golain platform CLI and TUI (formerly `platform-tui`). The CDN installer puts the binary at `~/.local/bin/golain` and adds a transitional **`platform-tui` → `golain` symlink** for existing scripts.

## CDN install (recommended)

Requires **curl**, **tar**, and **jq**. Default channel is **`stable`**.

```bash theme={null}
curl -fsSL https://tools.ilyama.golain.io/install.sh | sh
```

Install options:

```bash theme={null}
# Dev or latest channel builds
curl -fsSL https://tools.ilyama.golain.io/install.sh | sh -s -- --channel=dev
curl -fsSL https://tools.ilyama.golain.io/install.sh | sh -s -- --channel=latest

# Pin a version or custom prefix
curl -fsSL https://tools.ilyama.golain.io/install.sh | sh -s -- \
  --channel=stable --version=0.1.5b --prefix=$HOME/.local/bin
```

| Flag / env                      | Purpose                                                |
| ------------------------------- | ------------------------------------------------------ |
| `--channel=stable\|latest\|dev` | Release channel (`GOLAIN_CHANNEL`)                     |
| `--version=VERSION`             | Pin version instead of channel head (`GOLAIN_VERSION`) |
| `--prefix=DIR`                  | Install directory (default `$HOME/.local/bin`)         |
| `GOLAIN_BASE_URL`               | CDN root (default `https://tools.ilyama.golain.io`)    |

Channel manifests: `https://tools.ilyama.golain.io/manifest/{stable,latest,dev}.json`

## Verify and upgrade

```bash theme={null}
golain version
golain doctor
golain whoami          # after login

golain channel get
golain channel set --name=latest
golain upgrade
golain upgrade --force   # reinstall same channel version
```

If `golain version` prints shell syntax errors, the binary may have been corrupted by an old installer — reinstall from CDN:

```bash theme={null}
curl -fsSL https://tools.ilyama.golain.io/install.sh | sh -s -- --channel=stable --prefix=$HOME/.local/bin
file ~/.local/bin/golain   # expect Mach-O or ELF, not ASCII text
```

## Back-compat: `platform-tui`

The CDN installer creates `platform-tui` as a symlink to `golain`. Either name works; prefer **`golain`** in new docs and scripts.

## From source

Requires **Go 1.25+** and the [ilyama](https://github.com/golain-io/ilyama) repository.

```bash theme={null}
git clone https://github.com/golain-io/ilyama.git
cd ilyama

# Build binary → tools/platform-tui/dist/golain (or platform-tui via Makefile)
make platform-tui-build

sudo ln -sf "$(pwd)/tools/platform-tui/dist/golain" /usr/local/bin/golain
```

Run without installing:

```bash theme={null}
cd ilyama
make platform-tui-login   # authenticate
make platform-tui         # launch TUI
```

Or directly:

```bash theme={null}
cd ilyama/tools/platform-tui
GOWORK=off go run ./cmd/platform-tui [command]
```

<Note>
  `GOWORK=off` avoids the repo workspace `replace` for the MQTT fork when running from source on machines without `third_party/mochi-server/`.
</Note>

## Shell completions

```bash theme={null}
# bash
source <(golain completions bash)

# zsh
golain completions zsh | source

# fish
golain completions fish | source
```

## Config locations

| Path                                    | Contents                          |
| --------------------------------------- | --------------------------------- |
| `~/.config/golain/profiles/{name}.json` | Credentials + org/project context |
| `~/.config/golain/settings.json`        | Release channel, API environment  |
| `~/.config/platform-tui/profiles/`      | Legacy profile path (still read)  |

## Next step

→ [Login and authentication](/tools/platform-tui/login)
