I created an easy to use API to help businesses do incredible things with AI.
Laravel Tools

How to install Laravel on macOS

Benjamin Crozat
Published on Jan 15, 2024 0 comments Edit on GitHub
How to install Laravel on macOS

Introduction to installing Laravel on macOS

So, you finally decided to give Laravel a try.

But how do you even get started? Well, first, you must have a working PHP environment (see how to install PHP on macOS). Then, you must create a new Laravel project using the official Laravel installer or Composer (the package manager every PHP developer uses to manage dependencies).

Feels overwhelming? Don’t worry. In this article, I’ll show you exactly how to do that.

How to install Laravel on macOS

Using Composer

To install Laravel on macOS, Linux, or WSL, you can create a new project using Composer like so (given you already have a working PHP environment):

composer create-project laravel/laravel example-app

Then, you can just cd into your project and start the development server:

php artisan serve

Finally, open http://localhost:8000 in your browser.

But installing Laravel using Composer is limited and I will show you a better way.

Using the official Laravel installer

Laravel offers a convenient installer that you can add to Composer’s global packages using the following command:

composer global require laravel/installer

Then, you can create a new project:

laravel new example-app

If this command doesn’t work, make sure you followed my guide correctly.

The Laravel installer even offers options to create a new initialized Git repository with a first commit without having to go through the various prompts:

laravel new example-app --git

Or even use Pest as a default test runner:

laravel new example-app --pest

And you can combine these:

laravel new example-app --git --pest

There are a ton of options and you can see them all by running laravel new --help:

Description:
  Create a new Laravel application

Usage:
  new [options] [--] <name>

Arguments:
  name                             

Options:
      --dev                        Installs the latest "development" release
      --git                        Initialize a Git repository
      --branch=BRANCH              The branch that should be created for a new repository [default: "main"]
      --github[=GITHUB]            Create a new repository on GitHub [default: false]
      --organization=ORGANIZATION  The GitHub organization to create the new repository for
      --stack[=STACK]              The Breeze / Jetstream stack that should be installed
      --breeze                     Installs the Laravel Breeze scaffolding
      --jet                        Installs the Laravel Jetstream scaffolding
      --dark                       Indicate whether Breeze or Jetstream should be scaffolded with dark mode support
      --typescript                 Indicate whether Breeze should be scaffolded with TypeScript support (Experimental)
      --ssr                        Indicate whether Breeze or Jetstream should be scaffolded with Inertia SSR support
      --api                        Indicates whether Jetstream should be scaffolded with API support
      --teams                      Indicates whether Jetstream should be scaffolded with team support
      --verification               Indicates whether Jetstream should be scaffolded with email verification support
      --pest                       Installs the Pest testing framework
      --phpunit                    Installs the PHPUnit testing framework

Be the first to comment!

Get help or share something of value with other readers!

Great deals for enterprise developers
  • Summarize and talk to YouTube videos. Bypass ads, sponsors, chit-chat, and get to the point.
    Try Nobinge →
  • Monitor the health of your apps: downtimes, certificates, broken links, and more.
    20% off the first 3 months using the promo code CROZAT.
    Try Oh Dear for free
  • Keep the customers coming; monitor your Google rankings.
    30% off your first month using the promo code WELCOME30
    Try Wincher for free →
The latest community links
- / -