Install Laravel On Mac Xampp

When I try to run laravel app using XAMPP localhost, it gives me a white screen of death. However, when I use artisan serve, the app works fine. Here are the steps that I did: 1. I installed composer globally. Install laravel using the zip file and also through composer. Through zip file, I ran composer install. Move to that location where the directory is created. For installing the Laravel, the following command you have to type: composer create-project laravel/laravel - prefer -dist. The command mentioned above will make Laravel installed on that specific directory. Type the next command: php artisan serve. This above code will start the Laravel.

Laravel framework needs few requirements for getting installed on your system. A virtual machine has fulfilled each of these system requirements, Laravel's Homestead, hence it is a must to implement Homestead as the Laravel development environment for your local system.

Moreover, in case you do not use this virtual machine, the following requirements must be fulfilled:

  • PHP having version 7.0 or upper version
  • An OpenSSL extension for PHP
  • A PDO extension for PHP
  • Mbstring extension for PHP
  • Tokenizer extension for PHP
  • XML extension for PHP

Composer

Laravel implements a composer for managing dependencies within it. Hence, before the use of Laravel, it needs to check whether you have a composer setup on your system or not.

If you don't have Composer installed on your computer, first visit this URL to download Composer:

How To Install Xampp Windows

When you are done installing the Composer, cross-check whether it is installed or not by typing in the command prompt the composer command. You can see the Composer screen in that CMD only.

How

It needs to be kept in mind to put the Composer's system-wide vendor in the bin directory within your $PATH; as a result, your system can locate the executable of laravel. Depending on which operating system you are using, this directory will exist. Still, for PCs having OS like MAC and Linux, it will be:

Setup Laravel using Installer

First of all, you have to download the Installer of Laravel with the help of Composer, like this:

When the installation is done, a new command of laravel will start a new fresh installation in that directory you provide.

Create a Project

The next thing you have to do is make a new folder in some specific path within your system for keeping your Laravel projects. Move to that location where the directory is created. For installing the Laravel, the following command you have to type:

The command mentioned above will make Laravel installed on that specific directory. Type the next command:

This above code will start the Laravel service. A black screen will appear showing the message: Laravel Development server started on http://localhost:8080.

Copy and paste: http://localhost:8080 in your browser, and you can see the Laravel home screen appears in your browser.

Learn How to Install Laravel On Ubuntu Mac Step By Step with this guide.

If you are beginner on laravel and want to install laravel on your mac or ubuntu linux machine then this tutorial perfectly fits for your requirements.

For installing laravel on mac or ubuntu, we require PHP and composer on our machine.

So follow all the below steps to create your first basic project on laravel.

Step 1. Checking PHP version

First of all, let us check current installed php version on your machine. So open up your terminal.

Inside it, write down the following command and hit enter.

This command will give us the current version of the php. In my case I got the following results.

So, I have version number 7.2.14 on my system. For installing laravel, we need to have minimum version of PHP as described in the official documentation.

To check official recommended version, click here to go to official documentation.

If your machine have older version than the official recommendations, then you need to update php version. Otherwise no need to worry.

How to update PHP ?

You can have several ways to update your php version. For example, using homebrew or may be directly from the terminal.

For mac

If you are using Apple Mac, then I highly recommend you to use homebrew for updating PHP.

Go to the homebrew page using this link. Here, you will find one command to install homebrew on your mac.

Following is the command

Hit above command on your terminal and press enter. System will download homebrew and will install it automatically.

After this, type the below command to install PHP version 7.1,

You can replace 7.1 with the version number, you want to install.

Now again type command php -v . This time you should get the proper php version. If not then do little research on internet and try until you get proper php version in the results of php -v

For Ubuntu or Linux

To install php 7.3 version, type the below command in terminal

You in the last line, you can replace 7.3 with desired version.

Again check php version with help of, php -v command.

It is necessary to get greater or equal php version then the official recommendation in the results of “php -v” command.

Once your php version is ok with official version of laravel documentation, you are ready to install composer.

Step 2. Installing Composer

First of all, download the composer using the below command

You can check the official documentation for downloading composer here.

You should get the below lines when you have successfully installed composer.

Now let us put our composer in the global directory. For this, run the below command

You can find this command on this official link.

Now if you fire the below command

then you should get the below output

Ok, so till now, we have got the latest php version and have installed composer.

Step 3. Installing the Laravel

Write the below command in terminal

It will take little bit of time to download and install laravel.

Once this process is finished, we need to set up environment variable $PATH.

$PATH on Mac

If you are using mac, then your $PATH should like this according to documentation

$HOME/.composer/vendor/bin

Now I am using oh my zsh in my terminal. If you are also using this then run below command

If you are not using oh my zsh, then you can try something like

sudo vi ~/.bashrc or sudo vi ~/.bash_profile

Once you hit above command, you will be asked for password and then a text something like below will be opened

Now press i so that you will be able to edit above file.

Write down below line

below # export PATH=$HOME/bin:/user………

Then press Esc (escape) key, so that you can save the changes. For saving changes, press (:wq) this will written at the end of the file.

So new text should look like below

You can see that I have added a line below # export PATH=$HOME/bin:/user……… and also :wq is there at the end.

Now press enter and your $PATH is now updated with composer.

$PATH on Ubuntu

If you are using mac, then your $PATH should like this according to documentation

Xampp Control Panel Mac

Mac

$HOME/.config/composer/vendor/bin

Now hit following command

Then system will ask you for password and then it will show you some texts.

At the end of this text, type

export PATH=”$PATH:$HOME/.config/composer/vendor/bin”

and then save.

Step 4. What if I am facing issue in environmental variable $PATH

How To Install Xampp Server

Setting this variable is the little tricky process for both mac and ubuntu.

If you are facing issues then there is one solution for this.

Whenever you open your terminal simply run the below command on mac

and if you are on ubuntu then run

Now you should be able to create new laravel project.

Haworth By Haworth Design Studio & ITO Design Fern is the world’s first chair designed with edgeless comfort. Inspired by nature, Fern puts the person at the center of work with new levels of balance, flexibility, and performance. Haworth fern office chair.

How To Install Laravel On Mac Using Xampp

One drawback of this solution is that our settings will be destroyed when you close your terminal. So you need to repeat this process every time you open new session of terminal.

Now let us check if laravel is successfully installed or not. For this, simply type

How To Use Xampp On Mac

laravel and hit enter.

You should get below lines

If you are getting above lines then congratulations, you have successfully installed laravel on your machine!!