In this tutorial we will go over step by step on How to Install Laravel with MAMP on Mac OSX.
Let’s dive into the steps.
Download & Install MAMP
The first step is to make sure you have MAMP installed on your Mac.
MAMP is a free, local server environment that can be installed under macOS and Windows with just a few clicks. MAMP provides them with all the tools they need to run WordPress on their desktop PC for testing or development purposes.
Go to MAMP official website https://www.mamp.info/ and choose to download MAMP for OSX (Mac)
Use coupon 5balloons on this Cloudways Affiliate URL to get special discount.
This will download a
*.pkg installer on your MAC. Click the package to start installing MAMP.
Click on Continue to proceed with Installation. Go through the installation with all the steps.
The package will start writing files in your MAC.
Once the installation is successfully completed, You can now go ahead to start the MAMP.
Move to your Applications directory. You should see a MAMP directory created with following contents.
Click on MAMP to start the MAMP Control Panel (Which looks like below image)
Click on Start Servers to Start the MAMP Server. If the MAMP is installed correctly and the server started without any errors, you should see the following page on accessing
localhost in your browser.
Great job on installing the MAMP server. Let’s move to next step.
Download & Install Composer
Laravel makes use of composer for dependency management, So we need to make sure we have that installed in our system.
Open your terminal and type out command
composer -v, If this gives your the composer version that means you have composer already installed on your machine. If not follow below steps.
Download composer installer by this command in terminal
curl -sS https://getcomposer.org/installer | php
Move the composer to
mv composer.phar /usr/local/bin/composer
That’s it, you now have composer on your MAC. Test it out by command composer -v on terminal.
PHP version requirement
Latest version of Laravel i.e. 5.7 requires PHP >=7.1.3 , Although the latest MAMP will have the latest PHP, it might be the case that the PHP installed local to your MAC machine is old.
Check by running the following command on terminal.
If the version returned by this command is >=7.1.3 , then you are good to go. But if not then you either have to upgrade your php version on local mac, Or we can switch local PHP to use our MAMP php version which is greater than 7.1.3
Here is how you can do it.
- Within the Terminal, run
iand then paste the following at the top of the file:
(You can check the latest PHP version available in your MAMP directory (/Applications/MAMP/bin/php)
- Hit ESC, Type :wq, and hit Enter
- In Terminal, run source ~/.bash_profile
- In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install
- In case it doesn’t output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).
Alright, we are now all setup to install Laravel with MAMP.
Applications/MAMP/htdocs folder in terminal & run the following command
composer create-project laravel/laravel myProject "5.5.*"
This will start downloading the Laravel software and other required dependencies.
Once the Laravel installation is finished, Now it’s time to run the Laravel web application.
Navigate to the project you just created.
Run the following command.
php artisan serve
Then it will show you the url where project is running something like http://127.0.0.1:8000, Go to the browser and hit this url. You should see the Laravel home page.
Fantastic Job Done ! You have now installed Laravel with Mamp on Mac OSX. Have fun working with Laravel.
If you are looking for more Laravel tutorial we have got you covered -> Laravel Framework Tutorials and Examples