# Install prontaro CLI on macOS

Source: https://prontaro.com/docs/cli/macos/

Set up prontaro CLI on Apple Silicon and Intel Macs via Homebrew or install.sh, with zsh completion and launchd services.

## Quick install (Homebrew)

Homebrew is the recommended way to install `prontaro` on macOS: it puts `prontaro` on your `PATH`, installs `zsh`/`bash`/`fish` completions automatically, avoids Gatekeeper quarantine prompts, and upgrades cleanly with `brew upgrade`.

```bash
brew install prontaro/tap/prontaro
```

## Install without Homebrew (`install.sh`)

If you do not use Homebrew, run the official installer ([install.sh](https://prontaro.com/install.sh)) in Terminal:

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

The script detects Apple Silicon or Intel, verifies the SHA256 checksum, and installs `prontaro` into `/usr/local/bin` or `~/.local/bin`. If that directory is not on your `PATH`, it offers to add it to `~/.zshrc`.

Useful environment variables for `install.sh`:

```bash
# Pin a specific release
curl -fsSL https://prontaro.com/install.sh | PRONTARO_VERSION=0.2.0 sh

# Choose a custom directory and skip modifying shell rc files
curl -fsSL https://prontaro.com/install.sh | PRONTARO_INSTALL_DIR="$HOME/bin" PRONTARO_NO_MODIFY_PATH=1 sh
```

## Manual download and SHA256 verification

Fetch the current version from [latest.json](https://dl.prontaro.net/cli/latest.json), download the archive (`arm64` for Apple Silicon or `amd64` for Intel) with `SHA256SUMS`, and verify the checksum:

```bash
VERSION="$(curl -fsSL https://dl.prontaro.net/cli/latest.json | sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')"
ARCH="arm64" # or amd64 for Intel Macs

curl -fsSLO "https://dl.prontaro.net/cli/v${VERSION}/prontaro_darwin_${ARCH}.tar.gz"
curl -fsSLO "https://dl.prontaro.net/cli/v${VERSION}/SHA256SUMS"
grep "prontaro_darwin_${ARCH}.tar.gz" SHA256SUMS | shasum -a 256 -c -
```

Expected output: `prontaro_darwin_arm64.tar.gz: OK`. Extract and install the binary:

```bash
mkdir -p ~/.local/bin
tar -xzf "prontaro_darwin_${ARCH}.tar.gz" prontaro
install -m 0755 prontaro ~/.local/bin/prontaro
rm prontaro "prontaro_darwin_${ARCH}.tar.gz" SHA256SUMS
```

### Gatekeeper on browser downloads

Archives fetched with `install.sh` or `curl` skip macOS quarantine. If you download `.tar.gz` through Safari or Chrome, macOS attaches `com.apple.quarantine`, so Gatekeeper may block the first run.

Verify the SHA256 checksum first, then clear quarantine on that verified binary alone (never disable Gatekeeper system-wide):

```bash
xattr -d com.apple.quarantine ~/.local/bin/prontaro
```

## Sign in and state directory

Run `prontaro login` to sign in via your browser (no manual token copy-pasting needed), then check your account and connectivity:

```bash
prontaro version
prontaro login --label macbook-pro
prontaro status
prontaro doctor
```

See [CLI overview](https://prontaro.com/docs/cli/overview.md) for manual `--token` login, CI environment variables, and [Diagnostics and error codes](https://prontaro.com/docs/cli/errors.md) for every `doctor` check.

## Enable `zsh` completion

If you installed with Homebrew and Tab does not suggest commands, add to `~/.zshrc`:

```zsh
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit && compinit
```

Then open a new terminal window. If that does not help, run `rm -f ~/.zcompdump` and open a new window again.

If you installed with `install.sh` or manually, write the completion function into a directory on your `fpath`:

```zsh
mkdir -p ~/.zsh/completions
prontaro completion zsh > ~/.zsh/completions/_prontaro
```

Add the directory to `~/.zshrc` before `compinit` if it is not already there, then open a new terminal window:

```zsh
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit
```

## Run as a `launchd` service

To run a tunnel or port forward in the background, register a LaunchAgent (`~/Library/LaunchAgents/io.prontaro.<name>.plist`):

```bash
prontaro service install -- http 3000 --name local-api
```

Logs are written to `~/Library/Logs/prontaro/prontaro-<name>.log` and rotate automatically at 10 MiB (keeping up to 3 files). See [Background services (Linux & macOS)](https://prontaro.com/docs/cli/service.md) for `--system` LaunchDaemons, `--dry-run`, restarting after updates, and `uninstall`.

## Update and uninstall

### Update

If you installed via Homebrew:

```bash
brew upgrade prontaro/tap/prontaro
```

If you installed via `install.sh` or manually, update in place with `prontaro update`:

```bash
prontaro update
```

Running tunnels and `launchd` services pick up the new version after you restart them (`launchctl kickstart -k "gui/$(id -u)/io.prontaro.<name>"`).

### Uninstall

Remove any `launchd` services (`prontaro service uninstall -- <command>`), sign out, and remove the binary and local state:

```bash
prontaro logout

# If installed with Homebrew:
brew uninstall prontaro/tap/prontaro

# If installed with install.sh or manually:
rm -f ~/.local/bin/prontaro
# Or if installed into /usr/local/bin:
# rm -f /usr/local/bin/prontaro
rm -f ~/.zsh/completions/_prontaro

# Remove local state and logs:
rm -rf "$HOME/Library/Application Support/prontaro" "$HOME/Library/Logs/prontaro"
```

## Troubleshooting

- **`zsh: command not found: prontaro`:** Add `export PATH="$HOME/.local/bin:$PATH"` to `~/.zshrc` and run `source ~/.zshrc`.
- **Gatekeeper blocks a browser download:** Verify `SHA256SUMS`, then run `xattr -d com.apple.quarantine /path/to/prontaro`.
- **Corporate proxy or TLS error:** Test with `HTTPS_PROXY=http://proxy.example.com:3128 prontaro doctor` and confirm automatic clock sync is enabled in *System Settings → General → Date & Time*.

## Next steps

- [Open your first HTTPS tunnel in 2 minutes](https://prontaro.com/docs/start/tunnel.md) — expose a local web server over a permanent HTTPS address.
- [Background services (Linux & macOS)](https://prontaro.com/docs/cli/service.md) — `launchd` agents, log rotation, `--system`, and updates.
- [prontaro CLI command reference](https://prontaro.com/docs/cli/commands.md) — every subcommand and global flag with terminal examples.
- [Diagnostics and error codes](https://prontaro.com/docs/cli/errors.md) — troubleshooting with `prontaro doctor` and CLI exit codes.
