Guide on how to install Magento 2 on a mac

1 minute read

I needed a local installation to test and develop my data science services for Magento. So I was looking for the best way to install magento 2 on my macbook. There are a lot of different manuals out there on how to install magento on a mac, but they are all a bit outdated.

So here is the solution which worked best for me:

  1. Download and install the free version of MAMP which comes with PHP, a MySQL server and a web server. I first tried to install all the components with macports but ended up in configuration hell with Apache, different php versions and extensions. So if you want to save time I highly recommend using MAMP.

  2. add these line to your .bash_profile:
    alias phpm="/Applications/MAMP/bin/php/php7.1.8/bin/php"
    

    This makes an alias to the php version inside MAMP. MacOS comes with its own version of PHP and to avoid conflicts you can use phpm when ever you do something with magento. Like whenever you run .../bin/magento in your magento directory you should use phpm magento instead. (Note that the version might be different in your installation, so use your version instead of php7.1.8)

  3. Download Magento with or without sample data at https://magento.com/tech-resources/download. (Unless you want to directly develop Magento I recommend downloading rather then going the github/composer route)

  4. move the Magento folder to: /Applications/MAMP/htdocs

  5. Now start the MAMP servers and add a database for magento and write down the username and password. You can do that either with phpMyAdmin in “tools” at your MAMP website (http://localhost/MAMP/index.php?) or with a SQL tool like Sequel Pro

MAMP

  1. Install Magento with our browser (http://localhost) and note the admin page URL and password.

More info:

alextimmer.net

official

cron jobs