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

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# Install the AhaSend CLI (macOS, Linux, Windows)

> Install the AhaSend CLI on macOS, Linux or Windows with Homebrew, Scoop, npm, an install script, a .deb or .rpm package, or a binary download.

Install the AhaSend CLI with the tool you already use. The package managers, the install scripts and the downloads all install the same release binary.

## Choose a Method

| Method | Command | Platforms |
| - | - | - |
| [Homebrew](#homebrew) | `brew install ahasend/tap/ahasend` | macOS, Linux |
| [Install script](#install-script-macos-and-linux) | `curl -fsSL https://ahasend.com/install.sh \| sh` | macOS, Linux |
| [PowerShell script](#powershell-script-windows) | `irm https://ahasend.com/install.ps1 \| iex` | Windows |
| [Scoop](#scoop) | Add the AhaSend bucket, then `scoop install ahasend/ahasend` | Windows |
| [npm](#npm) | `npm install -g @ahasend/cli` | macOS, Linux, Windows |
| [.deb package](#debian-and-ubuntu-deb) | `sudo apt install ./ahasend_<version>_<arch>.deb` | Debian, Ubuntu |
| [.rpm package](#fedora-and-rhel-rpm) | `sudo dnf install ./ahasend-<version>-1.<arch>.rpm` | Fedora, RHEL |
| [Binary download](#binary-download) | Download from the [releases page](https://github.com/AhaSend/ahasend-cli/releases) | All |
| [Go](#go-install) | `go install github.com/AhaSend/ahasend-cli@latest`, then rename the binary to `ahasend` | All |

Each release has prebuilt binaries for macOS, Linux and Windows, on both x86\_64 and ARM64. The binaries have no dependencies.

After you install, check the version:

```bash theme={null}
ahasend --version
```

## Homebrew

```bash theme={null}
brew install ahasend/tap/ahasend
```

Use the full name `ahasend/tap/ahasend`. Homebrew adds the AhaSend tap and installs shell completion for bash, zsh and fish.

```bash theme={null}
# Upgrade
brew upgrade ahasend/tap/ahasend

# Uninstall
brew uninstall ahasend
brew untap ahasend/tap
```

## Install Script (macOS and Linux)

```bash theme={null}
curl -fsSL https://ahasend.com/install.sh | sh
```

The script downloads the latest release for your system, checks it against the release's `checksums.txt`, and installs it in `~/.local/bin` (or `$XDG_BIN_HOME` when it is set). It never uses `sudo` and never changes your shell profile. If the folder is not on your `PATH`, it prints the line to add, unless you pass `--quiet`.

Pass options after `sh -s --`:

```bash theme={null}
# Install a given version
curl -fsSL https://ahasend.com/install.sh | sh -s -- --version v0.3.0

# Install into another folder
curl -fsSL https://ahasend.com/install.sh | sh -s -- --install-dir ~/bin
```

| Option | Environment variable | What it does |
| - | - | - |
| `--version <tag>` | `AHASEND_VERSION` | Installs this release, such as `v0.3.0`. The default is the latest release. |
| `--install-dir <dir>` | `AHASEND_INSTALL_DIR` | Installs into this folder. |
| `--quiet` | | Prints only errors. |
| `--no-color` | | Prints without colors. |

If a package manager installed `ahasend` in the target folder, the script stops and tells you to upgrade it with that package manager, naming the command when it knows it, or to choose another folder with `--install-dir`.

To read the script before you run it, download it first:

```bash theme={null}
curl -fsSLO https://github.com/AhaSend/ahasend-cli/releases/latest/download/install.sh
less install.sh
sh install.sh
```

To upgrade, run the script again, with the same `--install-dir` if you used one. To uninstall, delete `ahasend` from the folder it installed into, by default:

```bash theme={null}
rm ~/.local/bin/ahasend
```

## PowerShell Script (Windows)

```powershell theme={null}
irm https://ahasend.com/install.ps1 | iex
```

The script works in Windows PowerShell 5.1 and PowerShell 7. It downloads the latest release for your system (x64 or ARM64), checks it against the release's `checksums.txt`, and installs it in `%LOCALAPPDATA%\Programs\AhaSend\bin`. It does not change your `PATH`: if the folder is not on it, the script prints the command that adds it, unless you pass `-Quiet`. Run that command, then open a new terminal. With `-Quiet`, use the `PATH` command in the [binary download](#binary-download) steps.

Pass parameters like this:

```powershell theme={null}
& ([scriptblock]::Create((irm https://ahasend.com/install.ps1))) -Version v0.3.0
```

| Parameter | Environment variable | What it does |
| - | - | - |
| `-Version <tag>` | `AHASEND_VERSION` | Installs this release, such as `v0.3.0`. The default is the latest release. |
| `-InstallDir <dir>` | `AHASEND_INSTALL_DIR` | Installs into this folder. |
| `-Quiet` | | Prints only errors. |

If the target folder is one that a package manager manages, such as Scoop's or npm's, the script stops and prints the command that upgrades `ahasend` with that tool instead, even when `ahasend` is not there yet.

To read the script before you run it, download it first:

```powershell theme={null}
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/AhaSend/ahasend-cli/releases/latest/download/install.ps1" -OutFile install.ps1
notepad install.ps1
powershell -ExecutionPolicy Bypass -File .\install.ps1
```

To upgrade, run the script again, with the same `-InstallDir` if you used one. To uninstall, delete `ahasend.exe` from the folder it installed into. With the default folder, delete the whole `AhaSend` folder:

```powershell theme={null}
Remove-Item -Recurse "$env:LOCALAPPDATA\Programs\AhaSend"
```

If you added the folder to your user `PATH`, the entry stays there. To remove it, open **Edit environment variables for your account** from the Start menu, select `Path` under your user variables, click **Edit**, and delete the entry that ends in `AhaSend\bin`.

## Scoop

```powershell theme={null}
scoop bucket add ahasend https://github.com/AhaSend/scoop-bucket
scoop install ahasend/ahasend
```

```powershell theme={null}
# Upgrade
scoop update
scoop update ahasend

# Uninstall
scoop uninstall ahasend
```

## npm

Needs Node.js 18 or later.

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

Or run it once without installing:

```bash theme={null}
npx @ahasend/cli --version
```

pnpm and Bun work the same way (`pnpm add -g @ahasend/cli`, `bun add -g @ahasend/cli`). The launcher runs with Node.js, so Bun also needs Node.js 18 or later. pnpm needs a global bin folder, which `pnpm setup` creates once.

The package installs the binary for your system as an optional dependency. If you install with optional dependencies turned off (for example `--omit=optional`), `ahasend` stops with a message that says so.

```bash theme={null}
# Upgrade
npm install -g @ahasend/cli@latest

# Uninstall
npm uninstall -g @ahasend/cli
```

> [!NOTE]
>
> With npm, `ahasend` runs through a small Node.js launcher, which passes the binary's exit code through. Two signal cases differ from the other install methods:
>
> * A `SIGINT` sent to the launcher process alone, by a tool that signals one process, does not reach the CLI. Ctrl+C in a terminal works as usual.
> * A tool that sends `SIGTERM` to the whole process group, such as `timeout`, makes the CLI receive it twice. `messages send` and `messages cancel` of several messages treat a second `SIGTERM` as "stop now", so they skip their clean stop.
>
> If either case matters to you, for example under a process supervisor, install the binary another way.

## Debian and Ubuntu (.deb)

These commands download the package of the latest release for your architecture (`amd64` or `arm64`) and install it. To install another release, replace the first line with that version, such as `VERSION=0.3.0`.

```bash theme={null}
VERSION=$(curl -fsSLo /dev/null -w '%{url_effective}' https://github.com/AhaSend/ahasend-cli/releases/latest | sed 's|.*/tag/v||')
ARCH=$(dpkg --print-architecture)
curl -fsSLO "https://github.com/AhaSend/ahasend-cli/releases/download/v${VERSION}/ahasend_${VERSION}_${ARCH}.deb"
sudo apt install "./ahasend_${VERSION}_${ARCH}.deb"
```

The package installs `/usr/bin/ahasend` and shell completion for bash, zsh and fish. There is no apt repository, so `apt upgrade` does not upgrade it. To upgrade, run the same commands again. To uninstall:

```bash theme={null}
sudo apt remove ahasend
```

## Fedora and RHEL (.rpm)

These commands download the package of the latest release for your architecture (`x86_64` or `aarch64`) and install it. To install another release, replace the first line with that version, such as `VERSION=0.3.0`.

```bash theme={null}
VERSION=$(curl -fsSLo /dev/null -w '%{url_effective}' https://github.com/AhaSend/ahasend-cli/releases/latest | sed 's|.*/tag/v||')
ARCH=$(uname -m)
curl -fsSLO "https://github.com/AhaSend/ahasend-cli/releases/download/v${VERSION}/ahasend-${VERSION}-1.${ARCH}.rpm"
sudo dnf install "./ahasend-${VERSION}-1.${ARCH}.rpm"
```

The package installs `/usr/bin/ahasend` and shell completion for bash, zsh and fish. There is no dnf repository, so `dnf upgrade` does not upgrade it. To upgrade, run the same commands again. To uninstall:

```bash theme={null}
sudo dnf remove ahasend
```

## Binary Download

Every release has a binary for each system, with the same name in every release:

| System | Binary |
| - | - |
| macOS, Apple Silicon | `ahasend-darwin-arm64` |
| macOS, Intel | `ahasend-darwin-amd64` |
| Linux, x86\_64 | `ahasend-linux-amd64` |
| Linux, ARM64 | `ahasend-linux-arm64` |
| Windows, x64 | `ahasend-windows-amd64.exe` |
| Windows, ARM64 | `ahasend-windows-arm64.exe` |

> [tab] macOS and Linux
>
> Set `FILE` to the binary for your system, then download it and `checksums.txt`, check it, and install it:
>
> ```bash theme={null}
> FILE=ahasend-linux-amd64
> curl -fsSLO "https://github.com/AhaSend/ahasend-cli/releases/latest/download/$FILE"
> curl -fsSLO https://github.com/AhaSend/ahasend-cli/releases/latest/download/checksums.txt
>
> # Linux
> sha256sum --ignore-missing -c checksums.txt
> # macOS
> shasum -a 256 --ignore-missing -c checksums.txt
> ```
>
> If the check prints `OK` for the file, install it. If it prints `FAILED`, delete the file and do not run it.
>
> ```bash theme={null}
> chmod +x "$FILE"
> mkdir -p ~/.local/bin
> mv "$FILE" ~/.local/bin/ahasend
> ```
>
> If `~/.local/bin` is not on your `PATH`, add this line to your shell's startup file (such as `~/.bashrc` or `~/.zshrc`):
>
> ```bash theme={null}
> export PATH="$HOME/.local/bin:$PATH"
> ```
>
> In fish, run this once instead:
>
> ```fish theme={null}
> fish_add_path ~/.local/bin
> ```
>
> > [!NOTE]
> >
> > macOS blocks a binary that you download with a browser, because Apple has not notarized it. Remove the download flag from the file before you run it:
> >
> > ```bash theme={null}
> > xattr -d com.apple.quarantine ~/.local/bin/ahasend
> > ```
> >
> > A binary downloaded with `curl` does not get the flag. Homebrew, the install script and npm installs do not need this step.

> [tab] Windows
>
> Use `ahasend-windows-arm64.exe` instead of `ahasend-windows-amd64.exe` on ARM64. These commands download the binary and `checksums.txt`, check the binary, and move it into `%LOCALAPPDATA%\Programs\AhaSend\bin`:
>
> ```powershell theme={null}
> $file = 'ahasend-windows-amd64.exe'
> $ProgressPreference = 'SilentlyContinue'
> Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/AhaSend/ahasend-cli/releases/latest/download/$file" -OutFile $file
> Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/AhaSend/ahasend-cli/releases/latest/download/checksums.txt" -OutFile checksums.txt
>
> # Prints True when the binary matches checksums.txt
> (Get-FileHash $file).Hash -eq ((Select-String -Path checksums.txt -Pattern "  $file$").Line -split ' ')[0]
> ```
>
> If it prints `True`, move the binary into place. If it prints `False`, delete the file and do not run it.
>
> ```powershell theme={null}
> $dir = "$env:LOCALAPPDATA\Programs\AhaSend\bin"
> New-Item -ItemType Directory -Force -Path $dir | Out-Null
> Move-Item -Force $file "$dir\ahasend.exe"
> ```
>
> Add the folder to your user `PATH`, keeping the names such as `%USERPROFILE%` that your `PATH` already holds:
>
> ```powershell theme={null}
> $key = 'HKCU:\Environment'; $path = (Get-Item $key).GetValue('Path', '', 'DoNotExpandEnvironmentNames'); Set-ItemProperty $key Path ((@($path, '%LOCALAPPDATA%\Programs\AhaSend\bin') -ne '') -join ';') -Type ExpandString; [Environment]::SetEnvironmentVariable('AHASEND_PATH_CHANGED', $null, 'User')
> ```
>
> Then open a new terminal.

To upgrade, run the download, check and move commands again; the `PATH` is already set. To uninstall, delete the binary. On Windows, also remove the folder from your user `PATH`, as the [PowerShell script](#powershell-script-windows) section describes.

## Go Install

Needs Go 1.26 or later.

```bash theme={null}
go install github.com/AhaSend/ahasend-cli@latest
```

This installs a binary named `ahasend-cli` into `GOBIN`, or `$(go env GOPATH)/bin` when `GOBIN` is unset. Rename it to `ahasend` to use the commands in these docs. With the default Go bin directory:

```bash theme={null}
mv "$(go env GOPATH)/bin/ahasend-cli" "$(go env GOPATH)/bin/ahasend"
```

Make sure that directory is on your `PATH`. A `go install` build prints `dev` as its version, because only release builds carry a version number. To upgrade, run both commands again.

## Build from Source

Needs Go 1.26 or later, Git, and Make (optional).

```bash theme={null}
git clone https://github.com/AhaSend/ahasend-cli.git
cd ahasend-cli
make build
mkdir -p ~/.local/bin
cp bin/ahasend ~/.local/bin/ahasend
```

Without Make, run `go build -o bin/ahasend .` instead of `make build`. If `~/.local/bin` is not on your `PATH`, add it as the [binary download](#binary-download) steps show.

## Verify the Download

Every release has a `checksums.txt` with the SHA-256 of each file. The install scripts check it for you, and the [binary download](#binary-download) steps check it before they move the file. For any other file from a release, such as a .deb or .rpm package, download `checksums.txt` from the same [release](https://github.com/AhaSend/ahasend-cli/releases) into the same folder, then run, before you rename the file:

```bash theme={null}
# Linux
sha256sum --ignore-missing -c checksums.txt

# macOS
shasum -a 256 --ignore-missing -c checksums.txt
```

GitHub also records where each release file was built. With the [GitHub CLI](https://cli.github.com), check a file with:

```bash theme={null}
gh attestation verify ahasend-linux-amd64 --repo AhaSend/ahasend-cli
```

## Shell Completion

Homebrew and the .deb and .rpm packages install completion for bash, zsh and fish. For other install methods, or for PowerShell, generate it with `ahasend completion`.

> [tab] Bash
>
> ```bash theme={null}
> mkdir -p ~/.local/share/bash-completion/completions
> ahasend completion bash > ~/.local/share/bash-completion/completions/ahasend
> ```
>
> This needs version 2 of the `bash-completion` package, which most Linux systems have.

> [tab] Zsh
>
> ```bash theme={null}
> mkdir -p ~/.zsh/completions
> ahasend completion zsh > ~/.zsh/completions/_ahasend
> echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
> echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
> exec zsh
> ```

> [tab] Fish
>
> ```bash theme={null}
> mkdir -p ~/.config/fish/completions
> ahasend completion fish > ~/.config/fish/completions/ahasend.fish
> ```

> [tab] PowerShell
>
> ```powershell theme={null}
> New-Item -ItemType Directory -Force -Path (Split-Path $PROFILE) | Out-Null
> ahasend completion powershell | Out-File -Encoding utf8 "$(Split-Path $PROFILE)\ahasend-completion.ps1"
> Add-Content $PROFILE ". `"$(Split-Path $PROFILE)\ahasend-completion.ps1`""
> . $PROFILE
> ```
>
> Windows PowerShell 5.1 runs profile scripts only when the execution policy allows them. If `. $PROFILE` fails, run `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned` once.

## Remove Your Configuration

Uninstalling the CLI leaves your profiles in `~/.ahasend` (`%USERPROFILE%\.ahasend` on Windows). Delete that folder to remove them:

```bash theme={null}
# macOS and Linux
rm -rf ~/.ahasend
```

```powershell theme={null}
# Windows
Remove-Item -Recurse "$env:USERPROFILE\.ahasend"
```

## Troubleshooting

### Command Not Found

The install folder is not on your `PATH`. The install scripts print the line to add, unless you ran them with `--quiet` or `-Quiet`. To add the folder yourself on macOS and Linux, put this line, with your folder, in your shell's startup file, such as `~/.bashrc` or `~/.zshrc`, and open a new terminal:

```bash theme={null}
export PATH="$HOME/.local/bin:$PATH"
```

In fish, run this once instead, with your folder:

```fish theme={null}
fish_add_path ~/.local/bin
```

On Windows, use the `PATH` command in the [binary download](#binary-download) steps, with your folder.

### More Than One Copy

If `ahasend --version` shows an older version than you installed, another copy comes first on your `PATH`. List every copy:

```bash theme={null}
# macOS and Linux
which -a ahasend
```

```powershell theme={null}
# Windows
Get-Command ahasend -All
```

Remove the copies you do not use, with the tool that installed them. A manual install may also have put a copy in `/usr/local/bin` on macOS and Linux, or in `%LOCALAPPDATA%\AhaSend` on Windows; delete it there.

## Next Steps

1. [Set up authentication](https://ahasend.com/docs/cli/authentication.md)
2. [Start with the quick start guide](https://ahasend.com/docs/cli/quickstart.md)
3. [Explore available commands](https://ahasend.com/docs/cli/commands/messages.md)

## Related Guides

* [CLI authentication](https://ahasend.com/docs/cli/authentication.md), [REST sending guide](https://ahasend.com/docs/send-api/send-email.md), [SMTP settings](https://ahasend.com/docs/smtp.md).
* [Node.js SDK](https://ahasend.com/docs/guides/nodejs-sdk.md), [Go SDK](https://ahasend.com/docs/guides/go-sdk.md), [CLI configuration and output](https://ahasend.com/docs/cli/configuration.md).
* [API authentication](https://ahasend.com/docs/api-reference/authentication.md), [Permission scopes](https://ahasend.com/docs/api-reference/scopes.md).


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