Prerequisites
You’ll need to install these tools before setting up your development environment:Node.js and npm
Gutenberg requires Node.js v20 and npm v10. We recommend using Node Version Manager (nvm) for easy version management.Git
Gutenberg uses Git for version control. Install Git if you haven’t already:Docker Desktop
Docker powers thewp-env local WordPress environment. Install Docker Desktop for your platform:
- Windows: Docker Desktop for Windows (WSL2 backend recommended)
- macOS: Docker Desktop for Mac
- Linux: Docker Desktop for Linux
Windows 10 Home users should follow the WSL2 installation instructions for the best experience.
Setting Up wp-env
wp-env is the official WordPress local development environment tool. It creates a Docker-based WordPress instance with zero configuration.
Install wp-env Globally
Quick Start with wp-env
Start the Environment
Ensure Docker is running, then start wp-env:This command:
- Downloads the latest WordPress Docker image
- Creates a MySQL database
- Installs and activates your plugin
- Mounts your plugin code as a Docker volume
First-time setup may take several minutes as Docker downloads the required images.
Access Your WordPress Site
Once started, your WordPress site is available at:
- WordPress site: http://localhost:8888
- Admin dashboard: http://localhost:8888/wp-admin/
- Credentials: Username
admin, Passwordpassword
Managing wp-env
Essential Commands
Expected Output
Whenwp-env start completes successfully, you’ll see:
Accessing the Database
Using phpMyAdmin
phpMyAdmin is available by default at http://localhost:9000/Using External Database Tools
To connect with tools like Sequel Ace or MySQL Workbench:Find the MySQL Port
Start wp-env and note the MySQL port number in the output:Look for:
MySQL is listening on port {MYSQL_PORT_NUMBER}Setting Up for Gutenberg Development
If you’re contributing to Gutenberg itself, follow these additional steps:Clone the Gutenberg Repository
Gutenberg-Specific Environment
The Gutenberg project includes a custom.wp-env.json configuration:
.wp-env.json
- Mounts Gutenberg as a plugin
- Includes test themes
- Configures phpMyAdmin on port 9000
Alternative Development Environments
If you prefer not to use Docker, you can use these alternatives:Local by Flywheel
Local provides a GUI-based local WordPress environment.Install Local
Download and install Local from localwp.com
MAMP
MAMP is a classic Apache/MySQL/PHP stack for local development.Development Tools Configuration
Configure your editor for the best development experience:Visual Studio Code
Install these recommended extensions:- EditorConfig - Automatically configures editor settings
- ESLint - JavaScript linting
- Prettier - Code formatting
VS Code Settings
Add to your.vscode/settings.json:
.vscode/settings.json
Running Tests
Gutenberg includes comprehensive test suites:PHP and E2E tests require wp-env to be running. Start it with
npm run wp-env start before running these tests.Troubleshooting
Docker Issues
wp-env won't start
wp-env won't start
- Ensure Docker Desktop is running
- Check for port conflicts on 8888 (WordPress) or 9000 (phpMyAdmin)
- Try destroying and recreating:
wp-env destroy && wp-env start
Port 8888 is already in use
Port 8888 is already in use
Permission errors on Linux
Permission errors on Linux
Add your user to the Docker group:Then log out and log back in.
Next Steps
Create Your First Block
Build a custom block from scratch
Git Workflow
Learn the Git workflow for contributing