How to set up a Mac development environment with DDEV

June 14, 2018 3 min read

Edit this page
Architectural photo of angular glass planes against a cloudy blue sky
Photo by Maxime Le Conte des Floris on Unsplash.

This article was updated in 2020, please go to DDEV From Scratch on macOS.

In this video tutorial, we’ll show you how to use DDEV to set up a PHP development environment from scratch on macOS.

Using a local development environment means you’re working on your projects without risking injury to your live projects.

Follow instructions to install DDEV in the docs or watch this video for an overview.

How to install your Docker-based dev environment with DDEV

These are notes from the video tutorial. You can also check out the detailed install DDEV instructions in the docs.

First: Install Docker for Mac

The minimum requirements to run DDEV are Docker and Docker Compose, which comes bundled with Docker for Mac and Windows. DDEV pretty much works anywhere Docker will run.

Next: Install DDEV

Option 1: With Homebrew

You can install DDEV with Homebrew, and if you’re using Mac it’s a handy way to install.

brew tap ddev/ddev && brew install ddev

Option 2: Install the DDEV binary with a script

curl | bash

You run the same script later to upgrade.

Set up your first project with DDEV.

In a typical web development workflow, most of the time you’re working in a repository that includes the web root for your PHP application or website. So the first thing is to cd to change directory so you’re inside that project folder or docroot.

Then you’ll answer 3 questions about the project. DDEV will make a best-guess, and usually, you can keep the defaults.

  • Project name – DDEV will base the name on the current directory name.
  • Docroot – Again, DDEV will make a guess from the docroot you’re currently in.
  • Project type – DDEV will auto-detect if you’re using a CMS, or use PHP if you’re building a custom application.

The first time you configure a project, it will download the containers you need. In the future, it will come up even faster.

When you’re done, DDEV outputs a URL with the link to quickly view your site in your browser.

Working on a new project? Or an existing one?

If this is a first-time project based on a PHP CMS like TYPO3 CMS or Drupal, you would have to go through the installation steps to set up the site.

Otherwise, you might be loading an existing project, and you’ll want to import an existing database.

These are some good commands to know but check ddev -h to see the complete list.

  • ddev list to see what projects you have running.
  • ddev describe to get information about the project.
  • ddev ssh to SSH into the container.
  • ddev remove to throw away the container but not the database. Pick up your project quickly next time.

Need some help?

We hope the video helps you set up your new Mac web development environment set up. If you get stuck, we’re happy to help.