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 https://.apachefriends.org and download xampp 7 or latest.
Installing Composer.
Once installed run mysql and Apache. now we need to install composer as well from getcomposer.org.
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('https://getcomposer.org/installer', '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
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
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
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
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
127.0.0.1 localhost 127.0.0.1 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”
or
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.
to
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
9 comments
Important Link: how-to-start-mysql-using-command-line-macos
[…] How to setup laravel on macOS xampp 2019 […]
[…] So, to begin with, we need to have a laravel project, If you are starting from scratch then you should check here Create Laravel Project. […]
[…] First of all, you should have a project or localhost laravel setup. If you want to do everything from scratch check here first. […]
[…] How to setup laravel on macOS xampp 2019 laravel disqus integration guide plus example 2020 was last modified: January 16th, 2020 by Manu […]
[…] How to setup laravel on macOS xampp 2019 Github-bitbucket clone repository to local server Step by step with debugging 2020 was last modified: January 26th, 2020 by Manu […]
[…] How to setup laravel on macOS xampp 2019 Install Nodejs On Shared Hosting To Run NPM Commands 2020 was last modified: February 21st, 2020 by Mark Jones […]
[…] How to setup laravel on macOS xampp 2019 Install Composer On Shared Hosting 2020 ( Easiest Way ) was last modified: February 22nd, 2020 by Mark Jones […]
[…] How to setup laravel on macOS xampp 2019 How to create Vue js project using cli/npm | Updated 2020 was last modified: March 30th, 2020 by Manu […]
You must log in to post a comment.