Learn Magento 2.4 Installation On macOS

Updated 10 August 2021

In this blog, we’ll learn Magento 2.4 Installation On macOS. You can also follow my blogs for Magento 2.4 Installation on Ubuntu 20.04 and Windows.

Installation Requirements For Magento 2.4:

Operating systems

  • Distributions of Linux, including RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, macOS.

Memory requirement

  • Magento2 requires 2GB or higher RAM. 

Composer

  • Composer 2.x cannot be supported by Magento.

Web servers

  • Apache 2.4
  • Nginx 1.x

Database

  • MySQL 8.0
  • MariaDB 10.4

PHP

Magento supports PHP 7.4.0

Elasticsearch

  • As of 2.4.0 Magento, MySQL is no longer available for search purposes. You’re supposed to use Elasticsearch.
  • Elasticsearch 2.x, 5.x, and 6.x are no longer supported by Magento.

To get detailed information about system requirements, just visit the mentioned link: https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

What We’re Going To Use:

  • OSmacOS Catalina 10.15
  • SERVERApache 2
  • RAM8 GB
  • PHP: 7.4
  • MY SQL8.0
  • Composer: 1.10
  • Elasticsearch: 7.10

Magento 2.4 Installation On macOS

So let’s move to the installation part.

STEP 1: Installing Homebrew by execute the command below:

Now, Setting up the environment.

STEP 2: Install Apache2

(i) Apache Configuration

However, to support the web pages we will configure apache. 

Check for the following after opening the httpd.conf file:

listen 8080

And just like the image below, change this to listen 80

Now, made some changes to the DocumentRoot directory. You will find the following lines as shown below:

Besides that, change this to :

The next setting for your configuration is Allowing Overrides. Although, you will find it as shown below:

Modify it to:

AllowOverride all

Now, the rewrite_module need to be enabled. Just navigate to:

Uncomment this module so that we can use this module for Magento 2. We do so as follows:

Similarly, in the directory, we need to define the local user and the group we are using. The variables, by default, look like:

It would look like that,

Save and exit, httpd.config file and then run the command below:

STEP 3: Install MYSQL Server for database creation by executing the following commands and when a password is asked after the below three commands, simply press ENTER
STEP 4: Setting and installing PHP 7.4 and its modules

The commands necessary to manually install PHP 7.4 on macOS are listed below. Check the package names correctly on your macOS terminal.

(i) PHP Configuration

PHP would not run if we try running PHP on Apache just like we do. For this purpose, we have to return to our httpd.config file by executing the command below:

Now, adding up the path to PHP 7.4 module in httpd.conf file

LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so LoadModule php7_module libexec/apache2/libphp7.so

Additionally, you will find the DirectoryIndex index.htmlas shown below:

After finding it, update it as follows:

DirectoryIndex index.php index.html

and add the following:

<FilesMatch \.php$>

SetHandler application/x-httpd-php

</FilesMatch>

It will be similar to,

Save the file and restart the apache service after performing this action.

In the ~/.zshrc file, add the path to PHP 7.4 installation with the command line:

Meanwhile, make some changes to php.ini file

max_execution_time = 360
memory_limit = -1
upload_max_filesize = 1024M
short_open_tag = On
date.timezone = America/Chicago

Save and exit, php.ini file and then run the command below:

STEP 5: After the above steps, install the composer

brew install composer
brew install wget
/usr/local/Cellar/composer/2.0.8/bin
wget https://getcomposer.org/download/1.10.17/composer.phar
mv composer.phar composer
chmod -R 755 composer

STEP 6: Download Magento by using the composer:

To install magento2 with composer, first, create the Access keys of Magento marketplace. If you have an account on Magento Marketplace, simply sign in and generate the access keys. If you don’t have an account, create an account by registering yourself on marketplace.magento.com

For generating Access keys, login into Magento marketplace, and from the top right corner of the page where your user name is displayed, navigate to My profile > Marketplace > My products > Access Keys

After all, create a new pair of Access keys. You need to provide the public Key as a username and the Private Key as a password when prompt.

STEP 7: In addition, Enable requisite permissions and restart Apache2

STEP 8: Similarly, Install the Elastic Search to move further

The next step is to install Magento2. Open your browser first and enter “http://localhost/magento2”. You will get the output as similar below.

STEP 9: Likewise, execute the commands below to install Magento 2 by using the required variables such as host, database name, username, and password, etc.

when this command is successfully executed, the output will be identical as seen in the image below:

while the installation of Magento2 has been successfully completed, go to your browser and enter the IP address or your domain name. As a result, the homepage of your default eCommerce website will be like this:

STEP 10: Magento configuration

After all the above steps, you can now access your admin panel by using your credentials. Therefore, the admin login will open as in the image below.

You can’t log in to Magento Admin Panel after installation since two-factor authentication has been implemented in Magento2.4 and won’t be allowed you to log in. Hence, a page similar to the one below will open.

Moreover, to log in, we need a working email id. And then Magento sends an email to conduct the authentication on the given email id. In that case, the 2-factor authentication module must need to be disabled and later set up by the admin panel. Thus, we can disable 2FA by using the below command in the Magento web root directory:

bin/magento module:disable Magento_TwoFactorAuth

**We highly recommend you to continue with 2-factor authentication**

It looks like,

At last, the admin panel is accessible. In addition, this is what the default admin dashboard looks like.

In short, your eCommerce platform is ready to use.

Thanks For Reading!

At last, we hope it works for you! And during this blog, you have found something valuable.

Keep in touch!!

In case of any help or query, please contact us or raise a ticket.

Category(s) magento
author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project






    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home