> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# LaunchDarkly CLI

> This topic describes how to get started with the LaunchDarkly CLI.

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

## Overview

This topic describes how to get started with the LaunchDarkly CLI.LaunchDarkly provides a command line interface (CLI) so that you can set up and manage your feature flags, account members, projects, environments, teams, and other resources directly from the command line.

## Installation

The LaunchDarkly CLI is available for macOS, Windows, and Linux.

To install the LaunchDarkly CLI:

<CodeGroup>
  ```bash title="Install on macOS with Homebrew" theme={null}
      brew tap launchdarkly/homebrew-tap
      brew install ldcli
  ```

  ```bash title="Install on macOS, Windows, or Linux with npm" theme={null}
      npm install -g @launchdarkly/ldcli
  ```

  ```bash title="Pull from Docker" theme={null}
      docker pull launchdarkly/ldcli
  ```

  ```bash title="Build from source" theme={null}
      # Requires a Go development environment

      git clone git@github.com:launchdarkly/ldcli.git
      cd ldcli
      go build

      # The CLI binary is now accessible in the current directory as ./ldcli
  ```

  ```text title="Download executable from GitHub" theme={null}
      https://github.com/launchdarkly/ldcli/releases
  ```
</CodeGroup>

To update to the latest version of the LaunchDarkly CLI:

<CodeGroup>
  ```bash title="Update to latest version using Homebrew" theme={null}
      brew upgrade ldcli
  ```

  ```bash title="Update to latest version using npm" theme={null}
      npm update -g @launchdarkly/ldcli
  ```
</CodeGroup>

## Get started

To get started with the LaunchDarkly CLI, you need to authenticate yourself. Then, you can use [`setup`](#setup) to create and set up your first flag, run any of the ldcli [commands](/home/getting-started/ldcli-commands).

### Authentication

Before you run commands in the LaunchDarkly CLI, you need to authenticate yourself. You have a few options:

* Authenticate with your email and password. The `login` command provides a login link to the LaunchDarkly UI, requests your approval for the LaunchDarkly CLI to access your account information, and then stores an appropriate access token in the LaunchDarkly CLI's configuration file.
* Authenticate with an access token that you create, and use the `config` command to set the token for your session. The `config` command to controls authorization and other configuration values.
* Authenticate with an access token that you create, and pass the access token each command you run. Here's how:

<CodeGroup>
  ```bash title="Authenticate with your login" theme={null}
      # you only need to run this once
      ldcli login
  ```

  ```bash title="Authenticate with an access token, once" theme={null}
      # you only need to run this once
      ldcli config --set access-token <your access token>
  ```

  ```bash title="Authenticate with an access token, per command" theme={null}
      # add this flag to each command
      ldcli --access-token <your access token> <command> <other flags for command>
  ```
</CodeGroup>

To learn how to create an access token, read [Creating API access tokens](/home/account/api-create).

### Setup

The `setup` command provides a step-by-step guide to create a flag, install an SDK, and toggle that flag:

<CodeGroup>
  ```bash title="Run ldcli setup" theme={null}
      ldcli setup
  ```
</CodeGroup>

## Additional documentation

LaunchDarkly provides the following additional documentation:

* For more information about common commands, read [LaunchDarkly CLI commands](/home/getting-started/ldcli-commands).
* For details on how to use the LaunchDarkly CLI to perform local testing and development, read [Using the LaunchDarkly CLI for local testing](/guides/flags/ldcli-dev-server) and read [LaunchDarkly CLI dev-server reference](/guides/flags/ldcli-dev-server-reference). You can also use the `ldcli [command] --help` command to view usage information for all commands for the LaunchDarkly CLI.To view and contribute to the LaunchDarkly CLI source code, or to file issues for our team, visit the [LaunchDarkly CLI GitHub repository](https://github.com/launchdarkly/ldcli).
