Skip to content
PortBay

Local development

Craft CMS local development on a Mac — without Docker

Craft 5 needs PHP 8.2+, a real database and sixteen extensions — none of which requires the Linux VM every DDEV guide starts with. The Docker route assessed fairly, and the native one-click setup.

Nour Beiruti8 min read

Almost every Craft CMS local-development guide starts the same way: install DDEV, which means installing Docker, which on a Mac means running a Linux virtual machine to serve a PHP site. DDEV is a fine tool — but nothing in Craft's actual requirements demands it. Craft 5 needs PHP 8.2+, a real database (MySQL 8.0.17+, MariaDB 10.4.6+ or PostgreSQL 13+) and sixteen common PHP extensions — all of which run natively on macOS. Here's the honest comparison of both routes.

The DDEV route, assessed fairly

Craft's own tutorials use DDEV, and it earns the position: one config file gives every team member an identical containerized stack, with per-project PHP and database versions that can mirror production exactly. The costs are Docker's, not DDEV's: a VM that holds memory while idle, slower file I/O on macOS for big vendor/ trees, and one more daemon that has to be running before ddev start works. If your team already standardized on it — especially with Linux-specific services in the mix — stay; consistency across a team is worth real overhead. The general case against containers-for-web-dev is made honestly in our Docker-alternative guide.

The native route

Solo or in a small team, the native path is simpler than its reputation. Homebrew's PHP ships with nearly all sixteen required extensions compiled in (Intl, GD, BCMath and friends included — run Craft's server check script to confirm), and MySQL or Postgres install natively next to it. The fiddly parts are the usual ones — a web server config, trusted HTTPS for the control panel, and mail capture so Craft's system emails land somewhere visible. Assembling that by hand is a known quantity: our PHP version guide and local HTTPS guide cover those layers.

The one-click native setup

Or skip the assembly: PortBay (free, open source, macOS) provisions the Craft requirements per project — a pinned PHP 8.2+ runtime, a per-project MySQL, MariaDB or PostgreSQL database whose connection lands in your .env during setup, trusted HTTPS on yoursite.test(Craft's control panel and live preview behave properly on a real HTTPS origin), and Mailpit catching every system email. The setup:

composer create-project craftcms/craft mysite
# add the folder to PortBay, press Play
php craft setup   # point it at the .env credentials

Craft + PortBay, step by step

Three lines compress a real sequence, so here it is in full, in the order that avoids backtracking.

  1. Create the database first.Craft's installer asks for a working database before it does anything else. Open Databases in PortBay, pick MySQL, MariaDB or PostgreSQL (Craft 5 supports all three), name the instance, and click Create. First-time initialisation runs in the background and takes 30 to 120 seconds for MySQL and PostgreSQL. When it finishes, the Connection panel shows the host, port and user you will feed the installer, and a Client button opens mysql or psql preconfigured for the instance if you want to look inside it later.
  2. Create the project and add it. Run the composer command above, then point PortBay at the folder and set the document root to web, the directory Craft serves from. The project pins its own PHP version; if no 8.2+ install exists on the machine, the Languages screen shows the brew install command and can run it for you.
  3. Run the installer. php craft setup walks through the connection: host 127.0.0.1, the port from the instance's Connection panel, user root for MySQL and MariaDB or postgres for PostgreSQL, empty password. The wizard writes the values into .env and installs Craft. Linking the instance to the project in PortBay also injects DATABASE_URL and the DB_*variables into the project's process on every start, with your .env values winning on conflict.
  4. Press Play. PortBay issues a certificate for mysite.test through mkcert, resolves the hostname with its managed local DNS, and routes requests through a bundled Caddy edge to PHP-FPM. The control panel and Live Preview load on an HTTPS origin the browser trusts, with no port numbers and no certificate warnings to click through.
  5. Wire the system emails. Mailpit starts with the app and listens on 127.0.0.1:1025. Point Craft's email settings (Settings → Email, transport type SMTP) at that host and port, and every test of user activation or password reset lands in the local inbox at 127.0.0.1:8025 instead of a real mailbox.
  6. Debugging. The command palette toggles Xdebug per PHP project. Requests get slower while it is on, so treat it as a switch you flip for a session, not a default.

The end state: https://mysite.test/admin over trusted HTTPS, a database the project owns, and captured mail, with nothing installed beyond the engine binaries Homebrew put on the machine.

From there it's a normal Craft project — native composer speed, no VM, and the same app runs your other PHP and Node projects alongside it. The honest scope note: if you need production-parity containers or Linux-only services, that's DDEV's home turf; for the common case — building Craft sites on a Mac — the native stack is faster and lighter. Compared to the other managed tools, Herd gates databases and mail behind Pro, MAMP shows its age on HTTPS and domains, and ServBay does cover the stack on a subscription. PortBay is a free download if you want the one-click version.

PortBay mascot — a friendly blue tugboat

Give your projects and your agents a real local home.

Download for macOS

Free & open source · macOS 11+ on Apple Silicon · Pro from $10/mo