#C01 Running Drupal on Mac.

Will install Drupal on Mac and set up a working environment.

Notice.

This article was written when I was testing Drupal on a local environment before publishing it on Lightsail. After that, I selected Bitnami's Drupal, which I installed in the Tokyo region using the Lightsail blueprint, and it was set to 10.3.3 by default. After installation, I updated it, so this website is published using Drupal 10.3.5. *As of 30th September 2024

As mentioned in the article, the Mac environment is built using Drupal 11.0.4. We had planned to run Drupal 11.0.4 on AWS, but the Drupal instance provided by the Lightsail blueprint is not compatible with Drupal 11.0.4, so please understand that the article is published using Drupal 10.3.5 and the content is difficult to understand.

I will write about Amazon Lightsail in a separate article.

Setting Up a Local Environment.
My Environment
  1. MacBookProM1(2021) model
  2. Local server (required to run Drupal on a Mac) Orbstack Pro
  3. Local Docker environment DDEV v1.23.4
  4. I am using PHP8.3.10, MariaDB10.11.8, Drupal11.0.4, Bootstrap5 4.03.
  5. Terminal: iTerm > Shell: Mac standard Shell Zch
  6. Package Manager: HomeBrew 4.3.22
  7. Composer Version 2.7.9
  8. Editor: Vscord 1.93.1
  9. Github Copilot 1.229.0
  10. Japanese Language Pack 1.93
  11. PHP Debag 1.35.0
  12. Remote SSH 0.114.3
  13. SSH: Editing Configuration Files 0.86.0
  14. Remote Explorer 0.4.3
  15. Vim 1.28.1

As of 16/09/2024 (Mon)

Drupal 11.0.4 and Bootstrap5 4.0.3

Originally, the Drupal 10.x website was built using CivicTheme, but when we updated to Drupal 11.x and checked the compatibility, we found that CivicTheme was not yet compatible with the 11 series, so we looked for another theme and found that Bootstrap 5 4.03, which we are using this time, was already compatible, so we adopted Bootstrap 5 as the design theme.

1.Running Drupal on Mac.

Drupal is a CMS for web applications that run on PHP and a database, so you need to set up PHP and the database to run on your Mac.

When using WordPress, I was using MAMP as a local server, but as I want to use Docker containers with Drupal, I need to build an environment where Docker containers can run, so I will use Orbstack, a Docker provider (an image that builds a Linux server within Mac, and has a packaged web server function). we will use Orbstack. Docker Desktop is the most popular Docker container, but when using DDEV, Orbstack is recommended, and we will use Orbstack because it is also excellent in terms of performance and stability.

Orbstack

The advantages of Orbstack are that it is easy to install, and even though it is a local environment, it starts up and runs quickly (e.g. web page display speed), and SSL functionality is available as standard. MAMP also allows you to use SSL, but the settings can be quite troublesome, and I myself use the paid version MAMP Pro when I run WordPress locally.

2.Installing Orbstack.

  Orbstack website

  Orbstack download page - Download in Zip format from here. As with other apps, you can install it simply by extracting the downloaded Zip and moving the app to the app folder. You can also install it using Home Brew, so it's very easy to introduce.

  Orbstack documentation - After installation, click the icon to start up. As mentioned in the documentation, you can also start it up using a command from the terminal.

3.Installing DDEV.

Once you have installed Orbstack, install DDEV. DDEV makes it easy to use Docker containers on your Mac.

  DDEV website

  DDEV documentation

DDEV

DDEV has a simple installation of CMS. Drupal also has a simple installation, and using Composer, Drupal can be installed on a Mac in a few steps and used immediately.

4.Installing Drupal.

Once you have installed DDEV, install Drupal.

  Drupal  Official Site

  Drupal Core

  DDEVのCMS  Quickstarts guide

Installation Procedure.

// Creating and moving to a folder

% mkdir my-drupal-site && cd my-drupal-site

// Write Drupal settings to the folder--php-version=8.3 is specified as PHP 8.3 because the stable version of PHP for Drupal 10.3 and later is PHP 8.3.

% ddev config --project-type=drupal --php-version=8.3 --docroot=web

// Drupal installation:recommended-project:^11 installs a stable version of Drupal Core 11 or higher.

 % ddev start ddev composer create drupal/recommended-project:^11

// Update the configuration file

% ddev config --update

//  Drush update

% ddev composer require drush/drush

// Initial settings for the Drupal admin screen - The login name is ‘account-name=admin’ - The password is set with ‘account-pass=admin -y’.

% ddev drush site:install --account-name=admin --account-pass=admin -y

// use the one-time link (CTRL/CMD + Click) from the command below to edit your admin account details.

// Issue a one-time login URL for the Drupal administrator login

% ddev drush uli

// Starting Drupal

% ddev launch

// The Drupal installation is now complete, and you can log in to the administration screen from your browser and start building your website with Drupal.

// Once the installation is complete and Drupal is running,

% ddev describe

// You can view the configuration file (you can also view it in composer.json in the root directory).

5.Additional Notes for DDEV.

After installing DDEV, install nss, mkcert and configure mutagen.

  nss > Client and server libraries for using https

  mkcert > Library for issuing SSL certificates for https in a local environment

  mutagen > Fast directory synchronisation tool

// mksert and mutagen settings

// nss installation

% brew install nss 

// Install mkcert

% mkcert -install

// mutagen settings

% ddev config global --mutagen-enabled 

The installation folder for brew install was set up for an Intel Mac, which is what I was running into trouble with. Because of this, I needed to change the path, but I was unable to proceed due to a Rozetta error. The settings I had used when I was using an Intel Mac were still in place after I had switched to an M1 Mac, so I took the opportunity to reinstall Homebrew and fix the problem.

 Installation Directory for Homebrew.

/opt/homebrew/ Installation destination for Apple Silicon homebrew

/usr/local/Homebrew Installation destination for HomeBrew on Intel Mac

6.PHP Version of Drupal core.

Drupal Core specifies the PHP version, and if the locally enabled PHP version does not match, you will not be able to install Drupal, so please use the PHP version specified by the Drupal Core you are installing.
% php -v *Check the PHP version.

Change the PHP Version at Will.

  Direnv

Drupal 11.x has only just been released, and depending on the theme, there are still many issues with Drupal 11.x, and there are also many that cannot be installed or updated due to dependency checks, so depending on the theme used, there may be cases where you need to use Drupal 11 or earlier , since the operating environment for Drupal 11.x is PHP 8.3 or higher, it is convenient to use Direnv when using Drupal 11 and PHP 8.3 or earlier, or when using Drupal 10.x or earlier projects in combination.

Direnv allows you to assign multiple PHP versions to each working folder, so you can use different versions of PHP to match the DrupalCore version specified by the theme you want to use, and you can use multiple projects with different versions on your Mac locally.

7.Conclude.

This time, I set up my Mac to be able to use Drupal, and I actually installed and ran Drupal. Here is a brief summary of the work I did.

  1. Building a local server environment - Installing Orbstack
  2. Building a container environment on a local server - Installing DDEV
  3. Setting up the local server environment, including Mutagen
  4. Checking the environment before installing Drupal - PHP version, DB version, etc. 
  5. I updated or installed the relevant software using Homebrew to prepare the necessary environment
  6. I installed Drupal using the easy installation function of DDEV CMS.

I installed Drupal 11.0.4 on my MacBook in this way.

Drupal Infrastructure Environment.

The reason I installed Drupal 11 is that I want to use AWS later on. When I looked into the AWS environment, I found that Lightsail has partnered with Bitnami to provide a Drupal environment.
When I checked the status of Drupal installations in the regions available on Lightsail, I found that all of them were the latest versions, and the versions of Drupal that could be used as standard were the latest 10.3.5 and 11.0.4, so I thought it would be better to use the latest 11 series if I was going to use AWS later on, and so I chose the latest Drupal 11.0.4 this time.

I'm still considering how to use AWS, but using a combination of EC2 and RDS, which is the most AWS-like way to use it, would be overkill for my environment and go over budget, so I'm considering using LightSail.

Notice.

This article was written when I was testing Drupal on a local environment before publishing it on Lightsail. After that, I chose Lightsail and installed Bitnami's Drupal on the Tokyo region, and the version was 10.3.3 by default. After the installation, I updated it, so this website is published on Drupal 10.3.5. *As of 30th September 2024

As mentioned in the article, we are using Drupal 11.0.4 to build the Mac environment. We had planned to run Drupal 11.0.4 on AWS, but since the Tokyo region of Lightsail does not support Drupal 11.0.4, we are publishing it using Drupal 10.3.5, so please understand that the article content is difficult to understand.

We will write about Amazon Lightsail in a separate article.

In the next section, we will select a theme that can be used with Drupal 11 and actually use it.

Next article.
Drupal Themes.

Olivero, which is the standard Drupal theme, is also a well-made theme, but Bootstrap 5, which is more flexible, can be used without any problems in the 11.x series, so we will install and configure Bootstrap 5.

Post
2024-11-02
Contributor
S.Takeda
Article
Related articles.

This is a related article on Drupal and web development. Please take a look if you like.

#C06 Installing Lightsail and Drupal.

The installation is easy to complete, as the virtual server called Lightsail and the optimised Drupal are installed at the same time.

#C26 Civic Theme

This is an article about Civic Theme, which sparked my interest in Drupal and led me to build and publish a website.

#C16 Basics of creating page.

I've been writing a series of articles on the basic concepts of Drupal that are necessary for creating pages, but since it's become a lot of articles and it's hard to understand, I'm going to organise them.

Side Bar 01

I migrated my lifestyle blog, which I created using Word Press, to Drupal, and I am currently updating it by adding articles in Drupal.

This is a blog written by a beginner who is learning Drupal.

This article will explain how to build a website using Drupal.

  All Article.

  Drupal Article.

  Web site Article.

  Mac Article.

  AWS Article.

This article is about second-hand clothes and fashion.

  All Article.

  Old-Clothes Article.

  Fashion Article.

  Watch Article.

  Photo Article.

  Recommended Shops.

Core Drupal 10.4.0

Theme Bootstrap5 4.0.3

  Drupal

  bootstrap5

  Bootstrap

  Font Awesome

  Amazon Web Service

  Amazon Lightsail

  Bitnami

  Google reCAPTCHA