How to setup laravel on macOS xampp 2019

How to setup laravel on macOS xampp 2019

How to setup laravel on macOS xampp 2019

So to setup laravel framework installation locally in macOS we need to follow few steps one by one .It should be pretty straightforward.So first of all install xampp for that go to and download xampp 7 or latest.

Installing Composer.

Once installed run mysql and Apache. now we need to install composer as well from

open terminal and go to Applications/XAMPP/htdocs through commands.We need to be in htdocs directory. If you don’t know how to do this then check this video out

Mainly commands used are as given below

cd .. //used for going back one directory
cd someFolder // someFolder is the directory where we enter using cd
sudo // it is required if permission error occurs
sudo chmod 777 someFolder //will allow read write full access to someFolder
ls // to see list of folders in directory
chmod -R 777 someFolder //will set all directory and sub directory full access of someFolder
clear // it is used for clearing the screen

Once in htdocs folder we need to run below given commands one by one to install composer to htdocs

php -r "copy('', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

After running these commands if we type “composer” and hit enter then it should give us below given pattern on terminal

How to setup laravel on macOS xampp 2019

After Installation of composer.

Ok if you see above content on your terminal that means you have composer installation was successful and it is working now move to laravel framework.

From the laravel website we need a command that we are going to run in htdocs directory
below is the command that will create a project with the name of “blog”,you can choose what ever name you want for your Laravel project but rest of the command stays the same.

composer create-project --prefer-dist laravel/laravel blog

It should go this way

How to setup laravel on macOS xampp 2019

You should have blog project in your Applications\XAMPP\htdocs folder. To access it  on browser type “localhost/blog/public”.You will see Laravel home page

How to setup laravel on macOS xampp 2019

Setting up Virtual host.

Now go to XAMPP/etc/extra/ and open a file named “httpd-vhosts.conf” with text editor and add below given content

How to setup laravel on macOS xampp 2019

After this in macOS go to Finder and look for option “Go”.
In Go find “Go To Finder” and type ” /private ” and click Go.

It will open a window where we need to go inside ” etc folder” and open ” hosts ” file with text editor. At bottom of this file add below given content	localhost	blog.test

Now restart XAMPP

Important: To enable custom virtual hosts to work you need to uncomment one line from ” XAMPP/xamppfiles/etc/https.conf”


uncomment one line from ” XAMPP/xamppfiles/etc/httpd.conf”

Remove “#” from the front of

#Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

# Virtual hosts
#Include etc/extra/httpd-vhosts.conf



Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

All done, Laravel project installation complete. Now you can look for “blog.test” in web browser ,It should work if still face any problem restart xamp local server or computer.
Check laravel collective guide here

%d bloggers like this: