Skip to main content
Neon Postgres Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

Neon CLI: Install and connect

Install. Install the Neon CLI globally with npm Requires Node.js 20.19.0 or higher. The CLI is invoked as neon, and neonctl is an alias for neon. Other install options Homebrew, bun, and standalone bi...

Install the Neon CLI globally with npm:

Bash
npm i -g neon@latest

Requires Node.js 20.19.0 or higher. The CLI is invoked as neon, and neonctl is an alias for neon.

Other install options

Homebrew, bun, and standalone binaries are also available. The Homebrew formula is named neonctl, so install commands use that name even though you run the CLI as neon.

Install with Homebrew

Bash
brew install neonctl

Install with bun

Bash
bun install -g neon

macOS binary

Download the binary. No installation required.

Bash
curl -sL https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-macos-x64 -o neon

Run the CLI from the download directory:

Bash
neon <command> [options]

Install with bun

Bash
bun install -g neon

Windows binary

Download the binary. No installation required.

Bash
curl -sL -O https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-win-x64.exe

Run the CLI from the download directory:

Bash
neon-win-x64.exe <command> [options]

Install with bun

Bash
bun install -g neon

Linux binary

Download the x64 or ARM64 binary, depending on your processor type. No installation required.

x64:

Bash
curl -sL https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-linux-x64 -o neon

ARM64:

Bash
curl -sL https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-linux-arm64 -o neon

Run the CLI from the download directory:

Bash
neon <command> [options]

You can also run the Neon CLI without installing it using npx or the bun equivalent, bunx:

Bash
# npx
npx neon <command>

# bunx
bunx neon <command>

Upgrade using the method that matches how you installed the CLI. To check for the latest version, see the Neon CLI Releases page. To check your installed version, run:

Bash
neon --version
Bash
npm update -g neon
Bash
brew upgrade neonctl

To upgrade a binary version, download the latest binary as described in the install instructions above, and replace your old binary with the new one.

In CI/CD tools like GitHub Actions, you can safely pin the Neon CLI to latest, as we prioritize stability for CI/CD processes.

In your GitHub Actions workflow, use the latest tag with npm:

YAML
- name: Install Neon CLI
  run: npm install -g neon@latest

If you're downloading a binary, reference the latest release from the Releases page using curl or wget in your workflow:

YAML
- name: Install Neon CLI
  run: |
    curl -L https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-linux-x64 -o /usr/local/bin/neon
    chmod +x /usr/local/bin/neon

The Neon CLI supports connecting via web authentication or API key.

Run the following command to connect to Neon via web authentication:

Bash
neon login

The neon login command launches a browser window where you can authorize the Neon CLI to access your Neon account. If you haven't authenticated previously, running any Neon CLI command launches the web authentication process automatically unless you've specified an API key.

To authenticate with a Neon API key, specify the --api-key option when running a Neon CLI command:

Bash
neon projects list --api-key <neon_api_key>

To avoid including --api-key with each command, export your API key to the NEON_API_KEY environment variable.

Bash
export NEON_API_KEY=<neon_api_key>

For information about obtaining a Neon API key, see Creating API keys.

The Neon CLI supports autocompletion. See Neon CLI commands: completion to set it up.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu