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:
- A macOS computer
- PHP 7.4 or higher
- Apache Web Server
- MySQL Database Server
- Composer
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:
- Open Terminal.
- Run the following command to download the Composer installer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- 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;"
- Run the installer:
php composer-setup.php
- Move the Composer binary file to the system's bin directory:
sudo mv composer.phar /usr/local/bin/composer
- 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:
- 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.
- Change directory to the Magento directory:
cd /Magento/magento2-master
- Install Magento dependencies:
composer install
- 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 [email protected] --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:
- Change directory to the magento2 directory:
cd /Magento/magento2-master
- 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.