How to run 2 Sanity Studios locally without port conflict?
You're getting that error because both studios are trying to use port 3333, which is Sanity Studio's default port. You have a couple of options to run multiple studios locally:
Option 1: Use the CLI flag (quickest)
When starting your second studio, specify a different port:
sanity start --port=3334Or for the first studio use 3333 and the second use 3334, etc.
Option 2: Configure it in sanity.cli.ts (persistent)
If you want to permanently set a different port for one of your studios, add this to the sanity.cli.ts file:
import {defineCliConfig} from 'sanity/cli'
export default defineCliConfig({
server: {
port: 3334, // or any other available port
},
// ...other settings
})This way, each studio will automatically use its configured port when you run npm run dev or sanity start.
Bonus tip: If you need to kill whatever's using port 3333 on macOS, you can run:
lsof -ti :3333 | xargs kill -9I typically use Option 2 for my projects since it means I don't have to remember which port each studio should use. Just set it once in the config and you're good to go!
More details in the running multiple studios locally answer and the localhost:3333 documentation.
Show original thread3 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.