August 26, 2022

Migrating my local development to DDEV..........finally!

Poor Docker performance is a thing of the past!

Migrating my local development to DDEV..........finally!
Poor Docker performance on my old Mac has long left me using MAMP for all my local Drupal, Wordpress & PHP development but with Drupal 9.4 now requiring PHP 7.4 and my MAMP version only supporting up to 7.3 I decided it was time to give DDEV another try! Here's how I started to migrate all my local Drupal, Wordpress & PHP development to DDEV!

What's DDEV & why bother with DDEV?

DDEV is an open source PHP development tool based on docker.
DDEV makes spinning up a local development environment really rather simple: a few commands, a config.yml file and a couple of minutes waiting and you can replicate your live server environments locally ready for local development.

For me as I mentioned in the intro the main reason was to easily be able to upgrade PHP versions give that Drupal 9.4 now enforces PHP 7.4 or above. DDEV makes that super easy with it currently supporting PHP or 8.1. It even supports older versions of PHP on ddev-contrib!

But DDEV isn't new, what took you so long?!

Yes very true, DDEV has been kicking a*se for awhile now (on it's 171st release at the time of writing!) and it's not the first time I've tried to use it. However, the performance of Docker (the magic behind DDEV) I was getting on my 2015 refurbished MacBook Pro was in short..........shocking. I never fully understood why but it was likely how Docker accesses the Mac filesystem, eitherway just loading a simple Drupal page (with no other apps open) would make the fans come on and take minutes to load, not good and not sustainable for local development.

For ease of use I stuck with MAMP for my local development which has done a job but updating it to get the latest PHP versions was always a pain I found and now with Drupal 9.4 requiring PHP 7.4 (which my MAMP version didn't have) I decide NOW was a good time to try DDEV again, so I did and I'm pleasantly surprised!!

Enter my DDEV performance saviour: Mutagen

So I'm sure you're wondering what's changed, won't the performance always be bad on a 2015 dinosaur of a Macbook Pro?
Well without fully understanding the inner workings of Docker I can't say for sure but what I can say is the new(ish) Mutagen config option in DDEV/Docker has literally changed my DDEV performance from near impossible to use to my now go to local development environment and all in the flip on 1 DDEV config option! More on that in a moment.

I don't have any benchmarks to boast about here and quite honestly they're not needed given that:

my 2015 Macbook Pro + DDEV/Docker - Mutagen = unusable!

Migrating a Drupal project to DDEV

Assuming you've followed the DDEV docs here: and you've installed Docker & DDEV successfully. Turn off MAMP or any other local development environments you might have so you avoid conflicts with DDEV.

  1. Start the Docker for Mac desktop app and then go to Preferences (top right corner "cog" icon)
  2. Under "File sharing" input the directory your Drupal site is within and then click "Apply & Restart" to give Docker access to the sites files.
  3. When Docker has restarted, open up Terminal and cd into your project directory (the same directory you just shared with Docker), I'm using a Drupal project setup with Composer using drupal/core-recommended
  4. Type ddev config and follow the workflow. Set your root to the directory where your Drupal index.php file is, for me with drupal/core-recommended that's /web.
  5. Now in Finder in your project directory (assuming you're allowing . (dot) directories to be visible, see you should now see a .ddev directory and inside that there should be a config.yml file.
  6. Open up the config.yml file in your code editor ad you'll see all the DDEV config options you can change, there's a load of code comments too if you want to read through all of them, that's on my todo list :).
    Change mutagen_enabled: false; to mutagen_enabled: true; to enable Mutagen mode!
  7. Optional: I already had local Drush aliases setup for so rather than create another set of Drush aliases just for the DDEV site I added an additional hostname to DDEV so the same Drush aliases could be use:
  8. Now back in Terminal type ddev start to fire up ddev. The mutagen sync can take a few minutes and if everything goes to plan you should see a message similar to this:
    Successfully started SITENAME
    Project can be reached at
  9. Use one of the above domains to ensure the site loads as expected, if you get taken to install.php then everything has worked so far.

To import an existing database dump into your DDEV site you have a couple of options:

  1. You could use your local Drush aliases & SQL sync (type ddev before your Drush command) : ddev drush sql-sync --create-db -y @SOURCE.SITE @local.SITE
  2. You could also use the ddev import-db command: ddev import-db --src=/tmp/mydb.sql.gz
  3. Or lastly, if you like an admin UI you can use PHPMyAdmin which is built into DDEV. Back in Terminal, type ddev describe to get a list of the services running, look for "PHPMyAdmin" and then copy the URL it's listed at ie.

For options #2 & #3 you can take a database backup either by logging into SSH and using mysqldump or if you prefer a UI within Drupal the backup migrate Drupal module does a nice job of that.

And that should get you migrated to DDEV! If you make any changes to the config.yml remember to run ddev restart or ddev start to refresh the loaded config.

This was Drupal example but I've also migrate PHP & Wordpress projects without issues (so far).

Other options for poor DDEV performance on old Macs

Linux Virtual Machine

I've heard of some developers using a Virtual Machine on Mac to load up Linux in the Virtual Machine. Docker runs well on Linux so it makes sense although one college of mine who does this said it works well but can be tricky to set up the file sharing between Mac OS & the Virtual Machine


From my understanding it solves performance issues similarly to mutagen but from my previous experience it actually made no difference to my Docker performance, maybe I did something wrong :)

Get a new Mac?

Well had to put the obvious one in there too :) Yes my Mac is old but I love it and I like the whole refurbish things idea given we now live in a World where we chuck again rather than reuse especially when it comes to technology!

Ok that wraps up this pretty short post, if it's wetted the appetite for DDEV I'd suggest heading over to the Official DDEV docs to learn more.

I'm trying to get into a better flow to write more regularly so sign up to the newsletter to stay up to date each time I post. Thanks for reading.