Firebase CLI & FlutterFire Setup
Phase 1: Create Your Firebase Account & Project
Since Firebase is a Google product, you don’t “create a Firebase account” from scratch — you use a Google (Gmail) account.
- Log In: Go to the Firebase Console and sign in with your Google account.
- Add Project: Click “Add project” (or “Create a project”).
- Name it, e.g.
<your-firebase-project-id>. - Google Analytics: optional and free to enable — more useful for frontend/mobile apps than pure backends.
- Name it, e.g.
Phase 2: Set Up the Firebase CLI
Install the Firebase CLI once via npm:
npm install -g firebase-tools
Log into Firebase using your Google account:
firebase login
firebase login --reauth
Test that the CLI is installed and accessing your account correctly by listing your Firebase projects:
firebase projects:list
The Firebase CLI will detect and use Application Default Credentials if they’re set — the simplest way to authenticate the CLI in CI and other headless environments.
(Legacy) FIREBASE_TOKEN
Alternatively, you can authenticate using FIREBASE_TOKEN. This is less secure than Application Default Credentials and is no longer recommended.
- On a machine with a browser, install the Firebase CLI.
- Start the sign-in process:
firebase login:ci
Phase 3: Set Up the FlutterFire CLI
Activate the FlutterFire CLI via Dart:
dart pub global activate flutterfire_cli
Make sure the pub-cache bin directory is on your PATH. Add this to your shell profile (~/.zshrc or ~/.bash_profile):
export PATH="$PATH":"$HOME/.pub-cache/bin"
source ~/.bash_profile
iOS/macOS prerequisite — the xcodeproj gem
The FlutterFire CLI needs to modify your Xcode project files to link Firebase correctly for iOS and macOS. It uses a Ruby-based tool called xcodeproj to do that. An error like cannot load such file -- xcodeproj means Ruby is installed but missing that specific gem.
Fix it by installing the gem directly:
sudo gem install xcodeproj
Phase 4: Run flutterfire configure
Inside your Flutter project, run:
flutterfire configure
To target a specific Firebase project and Android package name explicitly:
flutterfire configure \
--project=<your-firebase-project-id> \
--android-package-name=<your.app.package.name>