Skip to main content
Blog Magento 2

How To Install Magento 2 On MacBook

Siddharth Shukla
January 29, 2022 |

Adopting new technologies and leveraging them are definitely the needs of the hour in a digital commerce landscape as you cannot be left behind in terms of scalability and growth.

As you are looking for accurate steps to install Magento 2 on MacBook, you have reached the right place. Here’s a complete guide for you on the successful installation of Magento 2. 

Dive in to get a deeper look at the process.

Our easy steps to set up Magento 2.4.1 on Mac operating system 

Check out the exact steps for you to follow:

Web services Requirements

    Apache 2.2 or 2.4

    Nginx 1.x

Database Engine Requirements

    MySQL 5.7

    MariaDB 5.6, 5.7

PHP Requirements

    >= 7.4


    >= 7.7


    >= 1.x

Step 1: Install MAMP

  1. Here we need to download MAMP in our machine. Just click on the link for download MAMP in our machine.
  2. Once you successfully downloaded MAMP in your machine, then start the setup step by step.

3.After the setup is completed, open MAMP and click on preferences and setup the port link

below: apache: 80; Nginx: 80; MySQL: 3306

  1. Select Apache from the radio button
MAMP Config

Step 2: Install Composer

You can download from the composer website or you can use the command line for composer installation.

php -r “copy(‘’, ‘composer-setup.php’);”

php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”

php composer-setup.php

php -r “unlink(‘composer-setup.php’);”

sudo mv composer.phar /usr/local/bin/composer

Check whether the Composer is installed or not to run this command in terminal.

composer -v


Composer Magento

Step 3: Download Magento 2 Setup

Here we are going to download Magento 2 from the official website. Click on the link here. You can select the version from the drop-down and click on the download button.

Magento 2 Setup

Step 4: Now copy downloaded file to htdocs folder and extract the folder inside of htdocs.

Path: /Applications/MAMP/htdocs

Step 5: Install Elasticsearch for Magento 2.4.1

Elasticsearch is recommended by Magento 2.4.1. Just click on the link and you can download Elasticsearch in your system. After installing it successfully, you can run the Elasticsearch in your system.

elastic search

Once you clicked on Open, you can check your terminal. The code will execute. After successfully running the command, you can check localhost and port number 9200.


Magento elastic

Step 6: Now we need to create a database. You can use phpmyadmin or command line.

Step 7: Here we going to set up Magento 2.

Run the below command:

/Applications/MAMP/bin/php/php7.4.16/bin/php -dmemory_limit=5G /Applications/MAMP/htdocs/magento2/bin/magento setup:install –backend-frontname=”admin”  –db-host=”localhost”  –db-name=”magento”  –db-user=”root”  –db-password=”root”  –language=”en_US”  –currency=”USD”  –base-url=”http://localhost/dckap/”  –admin-user=”admin”  –admin-password=”root@123″  –admin-email=””  –admin-firstname=”admin”  –admin-lastname=”user”

In the above command, check your system path and also look for the ID and password for admin. You can select from your end and forget the database ID and password.

Step 8: After successfully running above command, you need to run the below command to set up Magento 2.

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo bin/magento setup:static-content:deploy -f

sudo php bin/magento c:f

rm -r pub/ var/ generated/

sudo chmod -R 0777 var/ generated/ pub/

php bin/magento maintenance:enable

rm -rf var/cache/* var/page_cache/* var/di/* var/generation/* var/view_preprocessed/* generated/* pub/static/*

php -d memory_limit=12G bin/magento setup:upgrade

php -d memory_limit=12G bin/magento setup:di:compile

php -d memory_limit=12G bin/magento setup:static-content:deploy -f

php bin/magento c:f

php bin/magento c:c

chmod -R 0777 var/ generated/ pub/static

php bin/magento maintenance:disable

Step 9: Now you can ensure the proper functioning of your Magento website.



In admin panel login, you need to put your credentials and you are now all set to go ahead and operate.

Magento Login

Admin Panel


If you want to disable Two Factor Authentication, then run the below command in the terminal inside of the project.

php bin/magento module:disable Magento_TwoFactorAuth

Interested to learn more about setting up Magento 2? Here’s another detailed blog on how to install Magento 2.4.1 on Windows 10

Final Thoughts

As a digital commerce ecosystem, DCKAP comes with 15+ years of expertise to aid you in running your eCommerce store with an improved digital presence. Our certified developers and team of experts are just a call away to help you out with your eCommerce needs. Get in touch with us and optimize your website for high performance.

Siddharth Shukla

More posts by Siddharth Shukla