Hello Folks! I am writing this post after a long time.

Today, I decided to start learning a new PHP framework, which is Laravel, for my master thesis. I am not going to talk about the pros and cons of this framework, it is already explained in detail on its official website (https://www.laravel.com/). I will explain how to install Laravel on Mac OS X with XAMPP step by step.

PHP is pre-installed on Mac OS X by default that’s why if you install XAMPP or WAMP on your mac, you will install the second PHP version. To find out which version of the PHP, you are running on your Mac, open your Terminal and run the command below:

If the output the path is:

You need to change to the PHP version, which you installed with XAMPP.  To do this, you should create a .bash_profile file on your home directory by using Terminal and run the commands below one by one:

Then you should add the following command inside the new .bash_profile file:

Afterwards, press control-x,  when the terminal asks you to save the change, type Y and press enter again. Then you should quit and re-open your Terminal.

To make sure that you have changed the PHP version correctly, you can run the “which php” command again and get the following output:

Laravel utilizes composer to manage its dependencies. So, before using Laravel, you should install the composer to your mac. To install the composer, you should follow these two steps;

1. Locate to htdocs folder by using Terminal

2. Download and install the composer inside the htdocs folder

Now, you are ready to install the Laravel! To install the Laravel, please run the following command on your Terminal.

That’s all! To make sure that everything works correctly, while your Apache server is running, open your browser and type http://localhost/laravel/public, the default Laravel page will be seen in your browser as can be seen below.

laravel-homepage

16 thoughts on “Installing Laravel on Mac OS X with XAMPP

  1. I did all of your steps and it worked, but on the end, when i trying to check it on the browser with http://localhost/laravel/public, i am getting to blank page.

    i have checked my XAMPP and the services are on.

    I see the folder of laravel project in the htdocs.

    What can i do?

    Thanks,

    Nir

  2. Ok i figured it out.. You are missing below 2 steps:

    Cd /Applications/XAMPP/htdocs/laravel

    After that, type the following ad hit enter

    sudo chmod -R 7777 storage

  3. (1/1) UnexpectedValueException
    The stream or file “/Applications/XAMPP/xamppfiles/htdocs/laravel/storage/logs/laravel.log” could not be opened: failed to open stream: Permission denied

    that’s what is happened for me :S

  4. Great Information. Thumbs up. Put this information also >>

    Cd /Applications/XAMPP/htdocs/laravel

    After that, type the following ad hit enter

    sudo chmod -R 7777 storage

  5. So great, steps are very much detailed and I was able to handle the errors by following additional instructions in the comment box :). Thank you for this guide!

  6. At the end, this line should change:
    $>composer create-project laravel/laravel dev-develop
    (or anyname of app, the name was dev-develop)
    and you should run this:
    $>sudo chmod -R 777 storage/*

Leave a Reply

Your email address will not be published. Required fields are marked *