MAMP allows you to run a local web development server with Apache or Nginx as well as MySQL with a simple GUI.
Composer is a dependency manager for PHP that helps keep track of packages like Craft CMS and allows easy installation and saving of these packages.
Download MAMP at https://www.mamp.info/en/downloads/
Install composer with the instructions at https://getcomposer.org/download/
Setup Craft CMS with composer by doing
composer create-project craftcms/craft <Path>
I have a projects folder I use for all my web projects and we will be able to point MAMP to use the folder we want. For me this looks likecomposer create-project craftcms/craft ~/Projects/craft-test
After successful installation, you will see thisOpen MAMP and go to MAMP > Preferences > Web Server and for Document Root select the
web
folder inside the folder you just composer installed Craft CMS into which would be~/Projects/craft-test/web/
In MAMP click start servers.
If the MAMP start page doesn't open automatically click Open WebStart PageGo to Tools > PHPMYADMIN
In the top left click new and enter a database name
craft-test
. The root user will be added to this database.Back in your terminal go to your craft project
~/Projects/craft-test
and enter./craft setup
to start the Craft setup. It will ask you a few questions. Here is the database info based on what you just created with MAMP and PHPMYADMIN.- Database type: mysql
- Host: localhost (or 127.0.0.1)
- Database port: 8889
- Database name: (the one you just created)
- Database user: root
- Database password: root
- You are also asked to create a site name and username/ password
After this is ran it will setup the database and tables and you should be all ready to go.
Open http://localhost:8888/admin or http://127.0.0.1:8888/admin and you can now login to your local Craft CMS