How to setup a Laravel Application on Mac and macOS cover image

How to setup a Laravel Application on Mac and macOS

Oliver Sarfas • November 25, 2020

programming laravel

It should be noted that this will NOT work on the new Apple M1 Silicon. We're waiting for Homebrew to be updated for this new round of processor.

Requirements and Steps

Installing Homebrew

Homebrew is advertised as the "Missing Package Manager for macOS". Put simply, they're on the dot. It's my go to for installing pretty much and command line based tool, or "developer solution" that doesn't have a GUI installer.

To get Homebrew installed, you'll need to run the following command in the terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the on screen instructions, and you're ready to go and install PHP as well as some other handy tools for Laravel Development.

Installing PHP & Composer

Now we've got Homebrew installed, installing our PHP service is as easy as one command in the terminal;

brew install php

And guess what, composer is just as easy too!

brew install composer

To confirm you've got the services installed, we can run php -v and then composer --version, to which we should see something similar to;

Terminal Screenshot of Output showing PHP and Composer versions

Install Laravel Valet

Laravel Valet is a blazing fast local development environment. The only downside that I've found so far is that you'll need a local database installation for your development, but this is easily remedied using brew install mysql.

To install Laravel Valet, simply install using composer, composer global require laravel/valet

Job done! We can now run Laravel applications from our local macOS machine by running the command valet open from their project directory

BONUS Install Lambo

This is a little tool that I personally love and use everytime I setup a new project. You need to first install the Laravel Installer, do this by running; composer global require laravel/installer.

Once this is installed, you'll be able to install lambo by running composer global require tighten/lambo.

You can follow their documentation here. It's a simple command line tool that makes setting up a new Laravel project super simple. It has arguments for adding auth, vue, "quiet mode", Git, React, and much more.


My next side-project is to get into Docker and potentially DDEV for this. If you've got any ideas on other content you'd like to see, get in touch using the social links below!

O

Questions? Want to talk? Here are all my social channels