> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/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.

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.

## Get started

To get started with the LaunchDarkly CLI, you install the CLI, authenticate yourself, and run `setup` to create your first flag. The following sections walk through each step.

<View title="Developer" />

<View title="Federal docs">
  <Danger>
    **Update the base URI to use the LaunchDarkly CLI in federal environments**

    If you are working in a LaunchDarkly federal environment, you must run the following command one time before continuing to work in the LaunchDarkly CLI: `ldcli config --set base-uri "https://app.launchdarkly.us"`.
  </Danger>
</View>

<View title="EU docs" />

### Installation

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

To install the LaunchDarkly CLI:

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

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

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

  ```bash title="Build from source" lines wrap 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" lines wrap 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" lines wrap theme={null}
  brew upgrade ldcli
  ```

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

After you authenticate, use [`setup`](#setup) to create and set up your first flag, or run any of the ldcli [commands](/docs/home/getting-started/ldcli-commands).

### Authentication

Before you run commands in the LaunchDarkly CLI, you must 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" lines wrap theme={null}
  # you only need to run this once
  ldcli login
  ```

  ```bash title="Authenticate with an access token, once" lines wrap 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" lines wrap 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](/docs/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" lines wrap theme={null}
  ldcli setup
  ```
</CodeGroup>

## Additional documentation

LaunchDarkly provides the following additional documentation:

* For more information about common commands, read [LaunchDarkly CLI commands](/docs/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](/docs/guides/flags/ldcli-dev-server) and read [LaunchDarkly CLI dev-server reference](/docs/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).
