Firebase CLI reference

The Firebase CLI (GitHub) provides a variety of tools for managing, viewing, and deploying to Firebase projects.

Before using the Firebase CLI, set up a Firebase project.

Set up or update the CLI

Install the Firebase CLI

You can install the Firebase CLI using a method that matches your operating system, experience level, and/or use case. Regardless of how you install the CLI, you have access to the same functionality and the firebase command.

Windows MacOS Linux

Windows

You can install the Firebase CLI for Windows using one of the following options:

Option Description Recommended for...
standalone binary Download the standalone binary for the CLI. Then, you can access the executable to open a shell where you can run the firebase command. New developers

Developers not using or unfamiliar with Node.js
npm Use npm (the Node Package Manager) to install the CLI and enable the globally available firebase command. Developers using Node.js

standalone binary

To download and run the binary for the Firebase CLI, follow these steps:

  1. Download the Firebase CLI binary for Windows.

  2. Access the binary to open a shell where you can run the firebase command.

  3. Continue to sign in and test the CLI.

npm

To use npm (the Node Package Manager) to install the Firebase CLI, follow these steps:

  1. Install Node.js using nvm-windows (the Node Version Manager). Installing Node.js automatically installs the npm command tools.

  2. Install the Firebase CLI via npm by running the following command:

    npm install -g firebase-tools

    This command enables the globally available firebase command.

  3. Continue to sign in and test the CLI.

Mac OS or Linux

You can install the Firebase CLI for Mac OS or Linux using one of the following options:

Option Description Recommended for...
automatic install script Run a single command that automatically detects your operating system, downloads the latest CLI release, then enables the globally available firebase command. New developers

Developers not using or unfamiliar with Node.js

Automated deploys in a CI/CD environment
standalone binary Download the standalone binary for the CLI. Then, you can configure and run the binary to suit your workflow. Fully customizable workflows using the CLI
npm Use npm (the Node Package Manager) to install the CLI and enable the globally available firebase command. Developers using Node.js

auto install script

To install the Firebase CLI using the automatic install script, follow these steps:

  1. Run the following cURL command:

    curl -sL firebase.tools | bash

    This script automatically detects your operating system, downloads the latest Firebase CLI release, then enables the globally available firebase command.

  2. Continue to sign in and test the CLI.

For more examples and details about the automatic install script, refer to the script's source code at firebase.tools.

standalone binary

To download and run the binary for the Firebase CLI that's specific for your OS, follow these steps:

  1. Download the Firebase CLI binary for your OS: Mac OS | Linux

  2. (Optional) Set up the globally available firebase command.

    1. Make the binary executable by running chmod +x ./firebase_tools.
    2. Add the binary's path to your PATH.
  3. Continue to sign in and test the CLI.

npm

To use npm (the Node Package Manager) to install the Firebase CLI, follow these steps:

  1. Install Node.js using nvm (the Node Version Manager).
    Installing Node.js automatically installs the npm command tools.

  2. Install the Firebase CLI via npm by running the following command:

    npm install -g firebase-tools

    This command enables the globally available firebase command.

  3. Continue to sign in and test the CLI.

Sign in and test the Firebase CLI

After installing the CLI, you must authenticate. Then you can confirm authentication by listing your Firebase projects.

  1. Sign into Firebase using your Google account by running the following command:

    firebase login

    This command connects your local machine to Firebase and grants you access to your Firebase projects.

  2. Test that the CLI is properly installed and accessing your account by listing your Firebase projects. Run the following command:

    firebase projects:list

    The displayed list should be the same as the Firebase projects listed in the Firebase console.

Update to the latest CLI version

Generally, you want to use the most up-to-date Firebase CLI version.

How you update the CLI version depends on your operating system and how you installed the CLI.

Windows

Mac OS

  • automatic install script: Run curl -sL firebase.tools | bash
  • standalone binary: Download the new version, then replace it on your system
  • npm: Run npm install -g firebase-tools

Linux

  • automatic install script: Run curl -sL firebase.tools | bash
  • standalone binary: Download the new version, then replace it on your system
  • npm: Run npm install -g firebase-tools

Use the CLI with CI systems

The Firebase CLI requires a browser to complete authentication, but the CLI is fully compatible with CI and other headless environments.

  1. On a machine with a browser, install the Firebase CLI.

  2. Start the signin process by running the following command:

    firebase login:ci
  3. Visit the URL provided, then sign in using a Google account.

  4. Print a new refresh token. The current CLI session will not be affected.

  5. Store the output token in a secure but accessible way in your CI system.

  6. Use this token whe