This post will guide you through the process of setting up DDEV on a Mac using Colima, an open-source Docker provider. As a developer, setting up a local development environment can be a daunting task, especially when working with complex projects like Drupal. Fortunately, tools like DDEV and Colima make it easy to get started quickly and efficiently. Note that there are alternative paid Docker providers available, such as Docker Desktop and OrbStack etc.
What is DDEV?
DDEV is a popular open-source tool that allows developers to set up a local development environment quickly and easily. It provides a simple and consistent way to create and manage local development environments for various projects, including Drupal.
What is Colima?
Colima is an open-source Docker provider that allows you to run Docker containers on your Mac. It's a lightweight and easy-to-use alternative to paid Docker providers like Docker Desktop and OrbStack.
Prerequisites
Before we begin, make sure you have the following installed on your Mac:
- Homebrew (a package manager for macOS)
- Docker ( installed via Colima)
Steps for setting ddev using colima
Install colima using brew run this command in your terminal.
brew install colima docker
Start colima by running command.
colima start
Install DDEV using brew.
brew install ddev
Create a Drupal project using recommended-project template and add drush, run below command.
composer create-project drupal/recommended-project project && cd project composer require drush/drush
Initialised dev configuration for Drupal project, run this command and provide answers for the prompt questions.
ddev config Creating a new DDEV project config in the current directory (/Users/dev/sites/project) Once completed, your configuration will be written to /Users/dev/sites/project/.ddev/config.yaml Project name (project): The docroot is the directory from which your site is served. This is a relative path from your project root at /Users/dev/sites/project You may leave this value blank if your site files are in the project root Docroot Location (web): Found a drupal codebase at /Users/dev/sites/project/web. Project Type [backdrop, cakephp, craftcms, django4, drupal, drupal6, drupal7, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress] (drupal): drupal10 Configuration complete. You may now run 'ddev start'.
Start DDEV by running the below command, this will start the DDEV container and make your project available at http://project.ddev.site
ddev start
Once DDEV start gets completed, we can install Drupal site using drush or from UI, let use drush to install the site, run below command.
ddev drush si --account-pass admin -y
- Visit your site in browser http://project.ddev.site
- Log in to post comments