Setting Up Laravel on MacOS

Aug. 19, 2017

After 3 years, I am using Laravel again at work. Laravel has extensive documentation but sometimes it can be a bit verbose. Here are command to get you started as soon as possible. This assumes pretty much fresh install of MacOS.

Install Homebrew

Check the official site for latest command

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install PHP 7.1

brew install homebrew/php/php7

Install MariaDB

brew install mariadb

Set MariaDB to start as service at the end of installation.

Install Composer

Get Composer fromĀ https://getcomposer.org/download/ and make sure to install it globally for easier use.

Install Laravel

composer global require "laravel/installer"

Add following line to .bash_profile in home directory

export PATH="$HOME/.composer/vendor/bin:$PATH"

And restart terminal or issue this command:

source ~/.bash_profile

Install Valet

Valet is very useful for setting up dev environment.

composer global require laravel/valet

valet install

Create Projects Directory

Now create a projects directory and let Valet know it should server from that directory.

mkdir ~/sites

cd ~/sites

valet park

Test your setup

Now in sites directory, create a new laravel project:

laravel new blog

and load http://blog.dev

If everything went smoothly, you should see a fresh Laravel project.