Local PHP on macOS

A local PHP development environment for Mac, piece by piece.

Every PHP project needs the same handful of things running on your Mac before you write a line of code. This page goes through what they are, the main ways to get them on macOS, and the trade-offs of each. Bothy is one of those ways: a native Mac app that runs PHP, MySQL/MariaDB, HTTPS and .test domains for you, with a bothy CLI and an MCP server for AI assistants.

What a local PHP environment needs

Strip away the branding and every local PHP setup is the same seven jobs. Whatever tool you pick, it's worth knowing which of these it does for you and which it leaves to you.

PHP, in more than one version

Client work rarely lines up on one version. A legacy WordPress site might need 7.4 while a new Laravel app wants 8.3 or later, so you need several versions installed side by side and a way to choose one per site, not per machine. On macOS that usually means php-fpm, with one process per version. More in running multiple PHP versions on a Mac and installing PHP on macOS.

A web server

Something has to accept requests and hand .php files to PHP. Apache (with .htaccess), nginx and Caddy are the usual choices. If your production server is Apache, .htaccess rewrite rules matter; nginx and Caddy don't read them.

A database

Most PHP projects expect MySQL or MariaDB. Ideally you can run more than one version, import a production dump without fuss, and take a snapshot before a risky migration.

Local HTTPS

Browsers treat plain HTTP differently: secure cookies, service workers, some OAuth callbacks and mixed-content rules all behave differently without TLS. A local certificate authority that your Mac trusts gives you real HTTPS with no warnings. See local HTTPS on macOS.

DNS for local domains

localhost:8888/shop works, but shop.test is closer to production and keeps cookies separate between sites. That needs a small DNS server (usually dnsmasq) plus a file in /etc/resolver/. Use .test, not .local: macOS treats .local as Bonjour, which makes lookups slow and flaky. See .test domains on a Mac.

Mail capture

Password resets and order confirmations need testing, and you don't want them reaching real inboxes. A local catcher such as Mailpit accepts everything and shows it in a web inbox. See testing PHP mail with Mailpit.

Debugging and logs

Xdebug for step debugging, and somewhere to read the PHP error log and access log without hunting for files. See setting up Xdebug on a Mac.

The main ways to run PHP locally on macOS

macOS no longer ships PHP, so everything below installs it one way or another. None of them is wrong; they suit different people.

Homebrew, by hand

Install PHP (the shivammathur/php tap has every current and older version), nginx or Caddy, dnsmasq and a certificate tool yourself, then write the config. It costs nothing and you learn exactly how it fits together. The price is time: each new site means a vhost, each PHP version a php-fpm service, and when something breaks after a brew upgrade you're the support desk.

Laravel Valet

Free, open source and CLI-only. Valet sets up Homebrew nginx, PHP and dnsmasq so every folder you park or link is served at name.test, with valet isolate for per-site PHP and valet secure for HTTPS. It uses very little memory. It has no database (the docs suggest DBngin) and no mail catcher, and the Valet docs now point newcomers to Herd. Compared in detail on Laravel Valet alternative.

Laravel Herd

A polished app from the Laravel team for macOS and Windows. It bundles its own PHP, nginx, dnsmasq and Node binaries, so you don't need Homebrew. The free version covers PHP, .test sites and HTTPS; Herd Pro ($99 a year) adds databases, Redis and other services, a mail inbox, a log viewer and Xdebug detection. It has its own MCP server. It's Laravel-first but serves other PHP too. See Laravel Herd alternative.

MAMP and MAMP PRO

The long-standing option, and the one many of us started on. Free MAMP gives you Apache or Nginx, PHP and MySQL on ports 8888 and 8889. MAMP PRO adds per-site PHP, automatic SSL, Mailhog, snapshots, deployment to live servers and, since 7.4.3, an MCP connection to Claude for Desktop. It also runs on Windows and supports Python, Perl and Ruby. See MAMP alternative.

Docker, DDEV and Lando

Containers put the whole stack in a Linux VM, defined in a file you can commit. That gives you close production parity and the same setup on every teammate's machine, at the cost of a VM's memory, slower file access from macOS, and, for larger companies, a Docker Desktop subscription. DDEV and Lando wrap Docker with PHP-friendly defaults. See PHP development without Docker.

Bothy

A native Mac app that does the Homebrew-by-hand setup for you and then manages it: PHP versions from the shivammathur/php tap, MySQL or MariaDB, Caddy and dnsmasq, run as launchd services. It adds monitoring, a CLI with --json on every command, and an MCP server for Claude, ChatGPT, Codex, Cursor and others. It's Mac-only, needs Homebrew, supports MySQL and MariaDB but not PostgreSQL, and costs $69 once.

Which one should you pick?

Honest short answers. Your stack decides more than any feature list.

How Bothy covers each piece

I built Bothy because I was tired of maintaining my own Homebrew setup across dozens of client sites, and none of the apps did quite what I wanted. It installs the same open-source parts you'd choose by hand, then keeps them running.

  • PHP: any version from the shivammathur/php tap, one php-fpm master per version and one pool per site, with per-site php.ini and environment variables. PHP in Bothy.
  • Web server: Caddy on ports 80 and 443. public/, web/ and htdocs/ are detected, and .htaccess RewriteRules are translated into the Caddy vhost.
  • Databases: several MySQL and MariaDB servers side by side on their own ports, snapshots, imports and phpMyAdmin. MySQL and MariaDB.
  • HTTPS and DNS: every site at https://name.test, subdomains included, with a local CA trusted once. Local HTTPS.
  • Mail: Mailpit at mail.test, with PHP mail() wired automatically. Mailpit.
  • Debugging: a per-site Xdebug toggle on port 9003, and live access, PHP and slow logs. Xdebug and live logs.

Services run as launchd user agents, so they keep running when you quit the app and restart if they crash.

  • Native, no VM or containers
  • App, CLI and MCP share one config
  • Needs Homebrew and macOS 14 or later
Bothy dashboard screen

The same thing from a terminal

Everything in the app is also a bothy command, and every command takes --json.

bothy site add shop --php 8.3 --db
bothy site open shop                 # https://shop.test
bothy site xdebug shop on
bothy site exec shop -- composer install
bothy logs shop --kind php

Create a site with its own database, turn on Xdebug, run Composer with the site's PHP, and follow its error log.

Framework guides

Bothy's starters create each of these in one step, with config already pointing at the site's database.

Local PHP with AI assistants

Bothy's MCP server gives assistants bothy_* tools for sites, databases, PHP, logs, mail and WP-CLI.

Questions

Does macOS come with PHP?

Not any more. Apple removed the bundled PHP in macOS Monterey, so you need to install it yourself, usually through Homebrew, or use an app that brings its own.

Do I need Docker for PHP development on a Mac?

No. Native tools run PHP directly on macOS, which is faster for file-heavy work and uses less memory. Docker is still the better fit when you need exact production parity or share a compose file with a team. See PHP without Docker.

Why use .test instead of .local or localhost?

.test is reserved for exactly this purpose. .local is used by Bonjour on macOS and causes slow lookups, and localhost with ports shares cookies between sites.

Can I run several PHP versions at once?

Yes, with php-fpm there's one process per version and each site points at the one it needs. Bothy, Herd, MAMP PRO and Valet all do per-site PHP.

Can I run Bothy alongside MAMP, Herd or Valet?

Not at the same time. Bothy uses ports 80 and 443, so stop the other tool first. Setup tells you what's in the way.

Is Bothy free?

No. It's $69 once, with every 1.x update included and no expiry. There's no free trial. See pricing.

Sources

Checked September 2026. Details change - check the vendor's site before deciding.

Get Bothy for $69.
One payment for every 1.x release. Version 2 will be a separate purchase.
Buy now