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:
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.
- add these line to your .bash_profile:
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/magentoin your magento directory you should use
phpm magentoinstead. (Note that the version might be different in your installation, so use your version instead of php7.1.8)
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)
move the Magento folder to:
- 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
- Install Magento with our browser (http://localhost) and note the admin page URL and password.