DDEV is an Open Source development environment that makes it easy to setup Drupal on your computer. It handles all the complex configuration by providing pre-configured Docker containers for your web server, database, and other services.
On macOS, you can install DDEV using Homebrew:
[code bash]$ brew install ddev[/code]Next, clone the Drupal CMS Git repository:
[code bash]$ git clone https://git.drupalcode.org/project/drupal_cms.git[/code]This command fetches the latest version of Drupal CMS from the official repository and saves it in the drupal_cms
directory.
Next, configure DDEV for your Drupal project:
[code bash]$ cd drupal_cms $ ddev config --docroot=web --project-type=drupal[/code]The --docroot=web
parameter tells DDEV where your Drupal files will live, while --project-type=drupal
ensures DDEV understands the project type.
Next, let's start our engines:
[code bash]$ ddev start[/code]The first time you start DDEV, it will setup Docker containers for the web server and database. It will also use Composer to download the necessary Drupal files and dependencies.
The final step is configuring Drupal itself. This includes things like setting your site name, database credentials, etc. You can do this in one of two ways:
The final step is configuring Drupal itself. This includes things like your site name, database configuration, etc. You can do this in one of two ways:
-
Option 1: Configure Drupal via the command line
[code bash]$ ddev drush site:install[/code]
This method is the easiest and the fastest, as things like the database credentials are automatically setup. The downside is that, at the time of this writing, you can't choose which Recipes to enable during installation.
-
Option 2: Configure Drupal via the web installer
You can also use the web-based installer to configure Drupal, which allows you to enable individual Recipes. You'll need your site's URL and database credentials. Run this command to get both:
[code bash]$ ddev describe[/code]Navigate to your site and step through the installer.
Once everything is installed and configured, you can access your new Drupal CMS site. You can simply use:
[code bash]$ ddev launch[/code]This command opens your site's homepage in your default browser — no need to remember the specific URL that DDEV created for your local development site.
To build or manage a Drupal site, you'll need to log in. By default, Drupal creates a main administrator account. It's a good idea to update the username and password for this account. To do so, run the following command:
[code bash]$ ddev drush uli[/code]This command generates a one-time login link that takes you directly to the Drupal page where you can update your Drupal account's username and password.
That's it! Happy Drupal-ing!