Setting Up Supabase Local Environment with Supabase CLI (Docker Desktop + macOS)
This article explains how to set up a local development environment using Supabase CLI on macOS.
Supabase CLI is a command-line tool that enables local Supabase development. It’s used for starting local databases, managing migrations, generating types, and more.
Developing locally allows you to safely develop and test without affecting your production environment.
To use Supabase CLI, you need the following:
Supabase CLI launches the local environment in Docker containers, so Docker Desktop must be installed and configured beforehand.
Download and install the macOS version from the Docker Desktop official website.
Alternatively, you can install it via Homebrew.
brew install --cask dockerAfter installation, launch Docker Desktop and verify it’s working in the terminal.
docker --version
# Docker version 27.x.x, build xxxxxxx
docker ps
# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESIf docker ps runs without errors, Docker is working correctly.
On macOS, install using Homebrew.
Note: Global installation via npm (
npm install -g supabase) is not supported. Please use Homebrew.
# Install Supabase CLI
brew install supabase/tap/supabase
# Check version
supabase --versionTo update Supabase CLI to the latest version, run the following command.
brew upgrade supabaseInitialize Supabase in your project directory.
# Navigate to your project directory
cd your-project
# Initialize Supabase project
supabase initRunning supabase init generates a supabase/ folder. This folder can be included in version control.
Start local Supabase with the following command.
supabase startThe first startup takes several minutes as Docker images need to be downloaded.
Once startup is complete, information like the following will be displayed.
Started supabase local development setup.
API URL: http://127.0.0.1:54321
GraphQL URL: http://127.0.0.1:54321/graphql/v1
S3 Storage URL: http://127.0.0.1:54321/storage/v1/s3
DB URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
Studio URL: http://127.0.0.1:54323
Inbucket URL: http://127.0.0.1:54324Access http://127.0.0.1:54323 in your browser to open Supabase Studio. This is Supabase’s graphical interface where you can create tables, view data, execute SQL, and more.
When you’re done developing, stop the local environment with the following command.
supabase stopTo stop while preserving data, simply run supabase stop. To reset data when stopping, use the --no-backup option.
# Stop and reset data
supabase stop --no-backup| Command | Description |
|---|---|
supabase init | Initialize project |
supabase start | Start local environment |
supabase stop | Stop local environment |
supabase status | Check local environment status |
supabase db reset | Reset database |
supabase migration new <name> | Create new migration file |
supabase gen types typescript | Generate TypeScript type definitions |
Cause: Supabase CLI is not installed, or PATH is not configured
Solution:
# Reinstall with Homebrew
brew install supabase/tap/supabase
# Check PATH
which supabaseCause: Docker is not running
Solution:
# Launch Docker Desktop
open /Applications/Docker.app
# Verify Docker is running
docker psCause: Docker is not functioning properly
Solution:
# Restart Docker Desktop
# Select "Restart" from the Docker icon in the menu bar
# Verify again
docker ps
supabase startCause: Another process is using the same port
Solution:
# Check which process is using the port (e.g., 54321)
lsof -i :54321
# Either terminate the process or change the port in Supabase settingsYou can customize port numbers in supabase/config.toml.
With Supabase CLI, you can run the complete Supabase stack locally. Being able to test production-equivalent features locally significantly improves development efficiency.
With just Docker Desktop and Homebrew, setup can be completed in minutes, so give it a try.
For more details, refer to the Supabase CLI official documentation.
That’s all from the Gemba, where we set up a Supabase local environment with Supabase CLI.