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
Section titled “Install”Install the Neon CLI globally with npm:
npm i -g neon@latestRequires 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
brew install neonctlInstall with bun
bun install -g neonmacOS binary
Download the binary. No installation required.
curl -sL https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-macos-x64 -o neonRun the CLI from the download directory:
neon <command> [options]Install with bun
bun install -g neonWindows binary
Download the binary. No installation required.
curl -sL -O https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-win-x64.exeRun the CLI from the download directory:
neon-win-x64.exe <command> [options]Install with bun
bun install -g neonLinux binary
Download the x64 or ARM64 binary, depending on your processor type. No installation required.
x64:
curl -sL https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-linux-x64 -o neonARM64:
curl -sL https://github.com/neondatabase/neon-pkgs/releases/latest/download/neon-linux-arm64 -o neonRun the CLI from the download directory:
neon <command> [options]You can also run the Neon CLI without installing it using npx or the bun equivalent, bunx:
# npx
npx neon <command>
# bunx
bunx neon <command>Upgrade
Section titled “Upgrade”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:
neon --versionnpm update -g neonbrew upgrade neonctlTo 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:
- name: Install Neon CLI
run: npm install -g neon@latestIf you're downloading a binary, reference the latest release from the Releases page using curl or wget in your workflow:
- 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/neonConnect
Section titled “Connect”The Neon CLI supports connecting via web authentication or API key.
Web authentication
Section titled “Web authentication”Run the following command to connect to Neon via web authentication:
neon loginThe 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.
API key
Section titled “API key”To authenticate with a Neon API key, specify the --api-key option when running a Neon CLI command:
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.
export NEON_API_KEY=<neon_api_key>For information about obtaining a Neon API key, see Creating API keys.
Configure autocompletion
Section titled “Configure autocompletion”The Neon CLI supports autocompletion. See Neon CLI commands: completion to set it up.