Magento 2 Installation Process for Mac for Local Development

  • Posted by Envision Ecommerce
  • /
  • June 30, 2016
Magento 2 Installation Process for Mac for Local Development

Magento 2 installation process on Mac for local development is not as straightforward as you might think. So, in this blog post, we will explain the Magento 2 installation by a direct installation process (Not being considering Vagrant or any virtual layer) for Mac. Here you will find everything from system requirements to MySQL 5.6.28 installation on Mac, other software requirements, Magento 2 installation steps to Magento 2 configuration.

System Requirements – Installation Prerequisites:

Ensure & verify the Magento 2 system requirements mentioned here, which will be required during the installation process and surely will help you to save your time.

1. You will need MAMP (a great tool to set up a local server environment) for the web server. We recommend you to use the free version.

2. Make sure that you have the PHP 5.6 version and up.

3. This Magento 2 installation process for Mac requires MySQL version 5.6. You may require an additional MySQL database to make this work efficiently. You also need to ensure that you are using a separate port from MAMP MySQL.

 

MySQL 5.6.28 Installation on Mac:

1. First, you need to download DMG file. You can download this file from here: http://dev.mysql.com/downloads/mysql/5.6.html#downloads
2. Double-click on the file to mount it and a window should pop up.
3. The next step is to run the .pkg file. It will also pop up an installation window.

4. Now, you need to click on “Continue” and then “Agree”, “Install” & “Close”.
5. Make sure you have the right version of MySQL database using port 3306. Now, restart it. Also, you can have the chance to make it connect with multiple database clients or utilizing the command line.

 

Other Software Requirements:

During this installation process, you also need to consider other software such as:
• GIT – To acquire Magento 2 files from Magento Github repository.
• Composer – To install Magento 2, you also require to download & install Composer
During this composer installation, you may receive PHP related error like you require a 5.6 at least to run composer, it may be due to the PHP version you’re currently having on your laptop is running through the command line, and not the php in mamp.

 

Easy Methods to Fix this Error:

type:

which php

to confirm.

If you notice /usr/bin/php, you can easily identify that it is utilizing the Mac version.
Discover the path to your MAMP php via:

cd /Applications/MAMP/bin/php

The next step is to check out the versions and select the path to one 5.6 version or greater than 5.6.
vi ~/.bash_profile

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

Now, you need to add the following line:
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
Easy & Effective Steps for Magento 2 Installation:

1. Now, everything seems to be ready and you first need to start configuring Apache to have a control over Magento 2 path.
For example: you can use http://local.magento2:8888/ and set up it in your /Applications/MAMP/htdocs.

To set up it, you can consider this piece of virtual host configuration:

# Magento_2
<VirtualHost *:8888>
ServerAdmin ********@*****.*** DocumentRoot “/Applications/MAMP/htdocs/magento2” ServerName local.magento2
ServerAlias local.magento2
ErrorLog “logs/local.magento2-error”
CustomLog “logs/local.magento2-access” common
</VirtualHost>

2. In the next step, you need to acquire Repository and run the command as mentioned below. It will help you to download the Magento 2 dev files.

git clone [email protected]:magento/magento2.git

3. Create the database by naming it “magento2”

mysql> CREATE DATABASE magento2;

4. Open a terminal window and cd to magento 2 root folder and run:

composer install

Once again, you can access and download composer from here – https://www.abeautifulsite.net/installing-composer-on-os-x

5. Once after completing the download of composer, cd to [magento2_instalation]/bin folder and follow these commands:

Now, you will require filling some parameters with the relevant data.

Here is a complete list covering almost all parameters available for installation. Have a look at this list:

  ./magento setup:install --db-host="127.0.0.1:3306" \
                                 --db-name="magento2" \
                                 --db-user="root" \
                                 --db-password="******" \
                                 --base-url="http://local.magento2:8888/" \
                                 --admin-user="admin" \
                                 --admin-password="**********" \
                                 --admin-email="[email protected]???????.???" \
                                 --admin-firstname="Name" \
                                 --admin-lastname="Lastname"

Note> The Base-URL is not a mandatory option.

After performing all above steps, visit this link: http://local.magento2:8888/ and you will be able to view the site as displayed below:

Magento 2 Configuration:

Once after completing the installation process, you need to start with Magento 2 configuration. Here is what you need to cover under post-install configuration settings:

  • Setting up cron
  • Security setting configuration
  • Making Apache server rewrites enabled
  • Server setting configuration
  • Magento Enterprise Edition (EE) settings