How to Install Magento Open Source on macOS

In this tutorial, we will guide you step-by-step through the process of installing Magento Open Source on macOS. Magento Open Source is an e-commerce platform that allows merchants to sell products online. By default, it comes with a number of advanced features that help in managing an online store.

Prerequisites

Before starting with the installation process, make sure you have the following prerequisites:

Step 1: Download Magento Open Source

First, download the latest version of Magento Open Source from the official website: https://github.com/magento/magento2. We recommend downloading the Master branch as it contains the latest features and bug fixes.

Step 2: Install Composer

Composer is a tool for managing PHP dependencies. It's required to install Magento 2. To install Composer on macOS, follow the steps below:

  1. Open Terminal.
  2. Run the following command to download the Composer installer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  1. Verify the downloaded file:
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
  1. Run the installer:
php composer-setup.php
  1. Move the Composer binary file to the system's bin directory:
sudo mv composer.phar /usr/local/bin/composer
  1. Verify the installation by running:
composer

You should see the Composer output in your Terminal.

Step 3: Install Magento Open Source

To install Magento 2 on macOS, follow these steps:

  1. Extract the downloaded Magento Open Source file to your preferred directory using this command:
unzip master.zip -d /Magento

This will create a new directory called Magento in the / directory.

  1. Change directory to the Magento directory:
cd /Magento/magento2-master
  1. Install Magento dependencies:
composer install
  1. Run the following command to complete the installation process:
php bin/magento setup:install --base-url=http://localhost/magento2 --db-host=localhost --db-name=magento2 --db-user=root --db-password=root --admin-firstname=admin --admin-lastname=admin --admin-email=admin@admin.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/New_York --use-rewrites=1

This command will install Magento 2 with sample data.

Step 4: Set the Required File and Folder Permissions

Magento 2 requires certain file and folder permissions to function properly. To set them, follow these steps:

  1. Change directory to the magento2 directory:
cd /Magento/magento2-master
  1. Run the following command to set the file and directory permissions:
chmod -R 777 var/ pub/ generated/

Step 5: Access the Magento Dashboard

Magento is now installed on macOS. To access the Magento dashboard, open a web browser of your choice and type http://localhost/magento2/ in the address bar. This will take you to the Magento setup page. Follow the on-screen instructions to complete the setup process and start using Magento.

Conclusion

Congratulations! Now, you know how to install Magento Open Source on macOS. If you encounter any problems during the installation, please refer to the official Magento documentation for more information.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!