Setting up Craft CMS locally with MAMP and Composer
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 like
composer create-project craftcms/craft ~/Projects/craft-test
After successful installation, you will see this
Open MAMP and go to MAMP > Preferences > Web Server and for Document Root select the
webfolder inside the folder you just composer installed Craft CMS into which would be
In MAMP click start servers.
If the MAMP start page doesn't open automatically click Open WebStart Page
Go 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
./craft setupto 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.