How to Install Laravel with MAMP on Mac OSX

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)

Livewire Component Library

Download MAMP Laravel

Host Laravel Application on DigitalOcean

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.

MAMP installation step1

Click on Continue to proceed with Installation. Go through the installation with all the steps.

MAMP installation step 4

The package will start writing files in your MAC.

MAMP Installation complete

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.

MAMP Directory MAC

Click on MAMP to start the MAMP Control Panel (Which looks like below image)

MAMP Control Panel

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.

MAMP default page localhost

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 /usr/local/bin/composer

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.

composer -v mac

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.

php -v

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.

  1. Within the Terminal, run vim ~/.bash_profile
  2. Type i and then paste the following at the top of the file:
     export PATH=/Applications/MAMP/bin/php/php7.2.8/bin:$PATH

    (You can check the latest PHP version available in your MAMP directory (/Applications/MAMP/bin/php)

  3. Hit ESC, Type :wq, and hit Enter
  4. In Terminal, run source ~/.bash_profile
  5. 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
  6. 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).

php mamp version mac

Install Laravel

Alright, we are now all setup to install Laravel with MAMP.

Navigate to 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.
composer install laravel mamp
Once the Laravel installation is finished, Now it’s time to run the Laravel web application.

Navigate to the project you just created.

cd myProject

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.

laravel home page mamp

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

Site Footer