Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kawax.biz/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

The Laravel team provides Herd and php.new for beginners, but senior engineers typically prefer managing each tool individually with a package manager. This gives you full version control and makes it easy to switch between different PHP versions across multiple projects. This guide walks you through installing PHP, Composer, and Node.js (via nvm) using Homebrew, all the way to a working laravel new setup.
Target environment: macOS 13 Ventura or later. Works on both Apple Silicon (M1/M2/M3) and Intel.

Installing Homebrew

Homebrew is the package manager for macOS. If you haven’t installed it yet, run the following in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, on Apple Silicon the following line is automatically added to your shell config file (e.g. ~/.zprofile). If you added it manually, reload your config:
eval "$(/opt/homebrew/bin/brew shellenv)"
Verify the installation:
brew --version

Installing PHP

1

Install the latest PHP

The Homebrew php formula always points to the latest stable version. Laravel 13 requires PHP 8.3 or higher.
brew install php
2

Verify the version

php --version
You should see PHP 8.3.x or higher.
3

(Optional) Use a specific version

If you need to manage multiple PHP versions, install a versioned formula:
brew install [email protected]
Switch between versions using brew link:
brew unlink php
brew link [email protected] --force --overwrite
Verify the currently linked version:
php --version

Installing Composer

1

Install Composer

You can install it directly via Homebrew:
brew install composer
2

Verify the version

composer --version
3

Set the global install path

To use packages installed with composer global require (such as the Laravel installer), add ~/.composer/vendor/bin to your PATH.Add the following to ~/.zshrc (or ~/.bashrc):
export PATH="$HOME/.composer/vendor/bin:$PATH"
Apply the changes:
source ~/.zshrc

Installing nvm

Node.js is installed per-user using nvm (Node Version Manager). Because no root privileges are needed, it works well alongside AI tools and CLIs that rely on global npm packages.
1

Install nvm

Check the nvm GitHub repository for the latest install script.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
2

Add the snippet to your shell config

The install script automatically appends the following to ~/.zshrc (or ~/.bashrc). If it wasn’t added, do so manually:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
Apply the changes:
source ~/.zshrc
3

Verify the installation

nvm --version

Installing Node.js

1

Install the LTS version

nvm install --lts
2

Set it as the default

Set the default version so it’s used automatically in new terminal sessions:
nvm alias default node
3

Verify the versions

node --version
npm --version

Verifying the Laravel Installation

1

Install the Laravel installer

composer global require laravel/installer
2

Create a new project

laravel new my-app
An interactive setup will begin where you can choose a starter kit, authentication options, and more.
3

Start the development server

cd my-app
php artisan serve
Open http://localhost:8000 in your browser. If you see the Laravel welcome page, you’re all set.

Homebrew vs. Herd

Manual Homebrew setupHerd
Target userDevelopers who want fine-grained version and config controlBeginners and solo developers who want a quick start
PHP version switchingManual via brew linkEasy switching from the GUI
Local domainsManual /etc/hosts editingAutomatic .test domains
Service managementbrew servicesStart/stop from the GUI
CustomizabilityHighLimited
The manual Homebrew approach is best when you want to match your team or CI environment’s configuration, or when you frequently switch between multiple PHP versions.
Last modified on April 10, 2026