How to install in Magento 2 in Macbook

Pinterest LinkedIn Tumblr

Here we going setup Magento 2.4.1 On mac operating system. you can follow step by step.

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 the start setup step by step.

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

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

4. Select Apache from radio button

Step 2: Install Composer

You can download from composer website or you can use 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 Composer installed or not run this command in terminal

composer -v


Step 3: Download Magento 2 Setup

Here we going to download Magento 2 from official website click on the link you can select version from dropdown and click on download button.

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 a recommended by Magento 2.4.1 Just click on the link and you can download Elasticsearch in your system after successfully installation you can run the elastic search in your system.

Once you clicked on open then you can check your terminal the code will execute after successfully run command you can check localhost and port number 9200


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

Step 7: Here we going for setup Magento 2 run 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="[email protected]"  --admin-firstname="admin"  --admin-lastname="user"

Above command check your system path and also look id password for admin you can select from your end and forget to database id and password.

Step 8: After Successfully run above command you need to run below command for setup 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

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 check your magento website will work properly


In admin panel login you need to put your credentials

Admin Panel

if you want disable Two Factor Authentication then run below command in terminal inside of project.

php bin/magento module:disable Magento_TwoFactorAuth

Credit goes to: Ajith Deevannagari(DCKAP)