---
title: Getting started with the CLI
editUrl: true
head: []
template: doc
sidebar:
  hidden: false
  attrs: {}
pagefind: true
draft: false
---

By the end of this page you'll have the CLI installed, a profile configured, and your first commands running.

## Before you start

- A Prefactor account with at least one environment

## Install

**macOS or Linux:**

```bash
curl -fsSL https://raw.githubusercontent.com/prefactordev/typescript-sdk/main/scripts/install.sh | bash
```

**Windows (PowerShell):**

```powershell
irm https://raw.githubusercontent.com/prefactordev/typescript-sdk/main/scripts/install.ps1 | iex
```

The binary installs to `~/.prefactor/bin/prefactor` on macOS/Linux or `%USERPROFILE%\.prefactor\bin\prefactor.exe` on Windows. The installer prints the PATH change needed if the bin directory isn't already on your path.

## Configure

```bash
prefactor login
```

This opens a browser to the Prefactor login page. After authenticating, copy your API token and paste it at the prompt. Credentials save to the `default` profile automatically.

Select which profile a command uses with `--profile <name>`.

## First run

```bash
# Verify access
prefactor accounts list

# List environments for your account
prefactor environments list --account_id <account_id>

# List agents in an environment
prefactor agents list --environment_id <environment_id>
```

## Verify

`prefactor accounts list` should return your account. If you see an authentication error, run `prefactor login` again.

## Where to go next

- [Configuration](/cli/configuration) — config file format, resolution order, and environment variables
- [API tokens](/admin-ui/account/api-tokens) — create and manage the tokens your profiles use