Supabase CLI
The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.
You can use the Supabase CLI to run the entire Supabase stack locally on your machine, simply by running supabase init
(to create a new local project) and then supabase start
.
The Supabase CLI provides tools to develop your project locally, deploy to the Supabase Platform, handle database migrations, and generate types directly from your database schema.
Installing the Supabase CLI
Updating the Supabase CLI
When a new version is released, you can update the CLI using the same methods.
If you have any Supabase containers running locally, stop them and delete their data volumes before proceeding with the upgrade. This ensures that Supabase managed services can apply new migrations on a clean state of the local database.
Logical backup
Remember to save any local schema and data changes before stopping because the --no-backup
flag will delete them.
_10supabase db diff my_schema_10supabase db dump --local --data-only > supabase/seed.sql
_10supabase stop --no-backup_10supabase start
Running Supabase locally
The Supabase CLI uses Docker containers to manage the local development stack. To get started,
- Install Docker Desktop
Intel-based Mac
If you are running Supabase on Intel-based Mac, disable MacOS Virtualization Framework to prevent Studio from being stuck in a crashloop.
Inside the folder where you want to create your project, run:
_10supabase init
This will create a new supabase
folder. It's safe to commit this folder to your version control system.
Now, to start the Supabase stack, run:
_10supabase start
This takes time on your first run because the CLI needs to download the Docker images to your local machine. The CLI includes the entire Supabase toolset, and a few additional images that are useful for local development (like a local SMTP server and a database diff tool).
The local development environment includes Supabase Studio, a graphical interface for working with your database, running by default on localhost:54323.
Stopping local services
When you are finished working on your Supabase project, you can stop the stack with:
_10supabase stop
Full command reference
The CLI provides a number of commands to help you develop your project locally and deploy to the Supabase Platform. You can find all commands inside the CLI Reference docs, including: