Just a harbour for your local open‑source server stack.

Hafen is a native macOS app for the servers you’d otherwise set up by hand: Caddy, PHP-FPM and MySQL, configured the way you would in the terminal. It runs all your PHP & MySQL sites side by side — each under its own https://client.test, with its own PHP version and its own database. Real server processes, trusted local HTTPS, and nothing in between.

  • macOS 14+
  • Apple Silicon & Intel
  • No Docker
  • No account
Hafen main window in light appearance: projects grouped in folders in the sidebar, project details on the right. Hafen main window in dark appearance: projects grouped in folders in the sidebar, project details on the right.
Fig. 1 Main window — projects in nested folders, service status at the bottom of the sidebar.

01 Built on

No proprietary engine. Just the parts you already trust.

Hafen doesn’t ship its own server. It installs, configures and supervises well-known open-source components — the same ones you could install with Homebrew and run by hand. Hafen writes their config files; you can read every one of them.

Bill of materials
Pos.ComponentFunctionSupplied byPort
01 Caddy The single web server on ports 80/443. One site block per project, php_fastcgi to PHP-FPM, its own local CA for HTTPS. Homebrew 80 · 443
02 PHP-FPM One php-fpm per PHP version in use. If the php formula would jump a minor version, Hafen installs php@8.5 instead — projects keep their version. tap shivammathur/php 90XY
03 MySQL 8.4 LTS The official Oracle build, downloaded and MD5-verified — no compiling. Each project can get its own database and its own user. Oracle CDN 3306
03a MariaDB alt. Instead of MySQL, if you prefer (Apple Silicon only — it can no longer be built on Intel Macs). mariadb-upgrade runs after updates. Homebrew 3306
04 Apache httpd opt. Per project, for code that needs .htaccess. Sits behind Caddy and uses the same PHP-FPM pools. Homebrew 8480
05 Adminer opt. One PHP file, SHA-256-verified, reachable only locally. “Open in Adminer” logs straight into the project’s database. GitHub releases 8090
06 Mailpit opt. Catches mail sent by PHP mail() (routed via sendmail_path) or over SMTP on 1025. Inbox in the browser. Homebrew 1025 · 8025
07 Xdebug Toggle per PHP version. Trigger mode — browser extension or ?XDEBUG_TRIGGER=1. tap shivammathur/extensions 9003
08 Homebrew The package source. Missing? Hafen offers to install it with the official script from brew.sh. brew.sh —
09 /etc/hosts One managed block between # BEGIN Hafen and # END Hafen. Everything outside it stays yours. macOS —

Runtime data, configs, databases and logs live in ~/Library/Application Support/Hafen/. Quitting the app stops all servers.

02 How it fits together

How a request finds its berth.

One web server in front, one PHP-FPM per version behind it, one database server for everything. Projects on the same PHP version share a pool — but never their settings.

Hafen architecture The browser resolves client.test through /etc/hosts to 127.0.0.1. Caddy on ports 80 and 443 terminates TLS with its local certificate authority and passes PHP requests to php-fpm 8.6 on port 9086 or php-fpm 8.5 on port 9085, or proxies to Apache on port 8480, which uses the same PHP-FPM pools. PHP talks to MySQL on port 3306. Mailpit catches mail on SMTP port 1025 with a web inbox on 8025. Adminer is served by Caddy on 127.0.0.1:8090. HAFEN-MANAGED · NATIVE PROCESSES · NO VM ~/Library/Application Support/Hafen Browser https://client.test /etc/hosts client.test → 127.0.0.1, ::1 :80 · :443 Caddy TLS termination site block / project CA local CA cert per domain :443 php-fpm 8.6 127.0.0.1:9086 php-fpm 8.5 127.0.0.1:9085 Apache httpd :8480 · .htaccess php_fastcgi reverse_proxy same FPM pools MySQL 8.4 :3306 db + user per project Adminer 127.0.0.1:8090 · local own site block Mailpit :1025 · :8025 mail() sendmail_path xdebug → IDE :9003 1 2 3 4 5
  1. Browser asks for client.test.
  2. /etc/hosts answers 127.0.0.1 and ::1 — from Hafen’s managed block.
  3. Caddy terminates TLS with a certificate from its local CA and picks the project’s site block.
  4. php_fastcgi hands the request to the pool for the project’s PHP version, with its PHP_VALUE.
  5. PHP connects to MySQL with the project’s own database user. 127.0.0.1 and localhost both work.

03 Certificates

One certificate authority. Zero certificate files.

Caddy is the central authority for every local domain. No mkcert, no per-project .pem files, no renewal reminders. Add a domain, and it is HTTPS.

  1. a

    Add a domain

    Type client.test in the project. Hafen rewrites the generated Caddyfile and the /etc/hosts block.

  2. b

    caddy reload

    Caddy picks up the new site block without dropping the other projects.

  3. c

    Certificate issued

    Caddy’s local CA signs a certificate for every domain listed — on the fly, and renews it by itself.

  4. d

    Trusted, once

    One click on Trust … in Setup puts the Caddy Local Authority root into your login keychain. Safari and Chrome accept every local site from then on.

Chain of trust: the Caddy Local Authority root, trusted in the login keychain, signs certificates for client.test, www.client.test and shop.test. Caddy Local Authority root · login keychain client.test www.client.test shop.test issued & renewed by Caddy Apache behind Caddy ~/Library/Application Support/Caddy/pki/authorities/local

What “Trust …” runs

security add-trusted-cert -r trustRoot \
  -k ~/Library/Keychains/login.keychain-db \
  …/local/root.crt
~/Library/Application Support/Hafen/Caddyfile generated
# Generated by Hafen – changes will be overwritten.
{
    admin localhost:2019
    local_certs
    skip_install_trust
    http_port 80
    https_port 443
}

# Client
client.test, www.client.test {
    @hafen_lan not remote_ip 127.0.0.0/8 ::1
    abort @hafen_lan
    root * "/Users/you/Sites/client/public"
    encode gzip
    @hafen_hidden path_regexp hafen_hidden /\.ht
    respond @hafen_hidden 403
    php_fastcgi 127.0.0.1:9086 {
        env PHP_VALUE "memory_limit=512M
upload_max_filesize=256M
post_max_size=256M
max_execution_time=300
max_input_vars=5000
display_errors=On"
    }
    file_server
}

# Shop
shop.test, www.shop.test {
    @hafen_lan not remote_ip 127.0.0.0/8 ::1
    abort @hafen_lan
    reverse_proxy 127.0.0.1:8480
}

# Adminer (database management) – local access only
http://127.0.0.1:8090 {
    bind 127.0.0.1
    root * "/Users/you/Library/Application Support/Hafen/adminer/www"
    php_fastcgi 127.0.0.1:9086 {
        env PHP_VALUE "memory_limit=512M
upload_max_filesize=256M
post_max_size=256M
max_execution_time=300
max_input_vars=5000
display_errors=On"
    }
    file_server
}
  1. local_certs — every site is signed by Caddy’s own local CA, never a public one.
  2. skip_install_trust — Caddy doesn’t touch your keychain on its own. Hafen asks once, in Setup.
  3. Every domain in a site address gets a certificate, and http:// is redirected to https://. Multisite domains are added here too.
  4. remote_ip / abort — macOS only lets a regular user open ports 80/443 on all interfaces, so Caddy listens everywhere and drops any request that doesn’t come from this Mac. Every site block has these two lines; they are left out when you allow local network access in Setup.
  5. PHP_VALUE is sent in full with every request, so projects sharing PHP 8.6 never inherit each other’s settings. It is one quoted string; the continuation lines start at column 0 in the real file and are only indented here.
  6. Apache projects get HTTPS as well: Caddy terminates TLS in front and forwards to Apache on 127.0.0.1:8480. Apache’s SetEnvIf X-Forwarded-Proto sets HTTPS=on for PHP.
  7. Adminer gets its own block: plain HTTP, bound to 127.0.0.1 only, so it is never reachable from the network – not even with local network access allowed. It runs on one of the installed PHP versions.

04 Under the hood

Where everything lives. And how to take it with you.

Every configuration Hafen writes is a plain, readable file in one folder. You can start every service by hand with exactly the commands Hafen uses — to troubleshoot, or to keep working without Hafen. The same explanations, in full, are in the built-in help under Under the Hood.

Where everything lives
~/Library/Application Support/Hafen/Everything Hafen generates and stores
CaddyfileCaddy config, one site block per running project, plus Adminer. Generated.
apache/httpd.confSelf-contained Apache config, only if Apache is installed. Generated.
php/8.6/php-fpm.confOne pool per PHP version, written on every start of that version. PID file next to it.
data-mysql/ · data-mariadb/Your databases. Never copy or edit while the server runs.
mysql-dist/8.4.x/bin/mysqld, mysql, mysqldump, mysqladmin from Oracle
run/mysql.sock and the *.pid files — only while services run
logs/One log file per service
projects.json · settings.jsonYour projects and the Setup settings, plain JSON
~/Library/Application Support/Caddy/Caddy’s own data: local CA, issued certificates
/opt/homebrew · /usr/localHomebrew prefix (Apple Silicon · Intel): caddy, php-fpm, httpd, mailpit, php.ini

Run it without Hafen

Quit Hafen first — that stops all services and frees the ports. Set two variables, then start what you need. Examples for PHP 8.6 on an Apple Silicon Mac.

Caddy & PHP-FPM

# the same two variables in every Terminal window
H="$HOME/Library/Application Support/Hafen"
B="$(brew --prefix)"

# web server, as Hafen starts it
caddy run --config "$H/Caddyfile" --adapter caddyfile
# one php-fpm per PHP version
"$B/opt/php@8.6/sbin/php-fpm" -F -y "$H/php/8.6/php-fpm.conf" -d xdebug.mode=off

Database & backup

M="$(echo "$H"/mysql-dist/*/bin)"
"$M/mysql" --no-defaults -uroot --socket="$H/run/mysql.sock"
"$M/mysqldump" --no-defaults -uroot --socket="$H/run/mysql.sock" \
  --single-transaction --routines --triggers --events client | gzip -c > client.sql.gz
Overwritten
The Caddyfile, httpd.conf, each php-fpm.conf, the Hafen block in /etc/hosts, projects.json and settings.json are rewritten whenever Hafen starts servers or you change something. Edits by hand only last until then — fine for a quick test followed by caddy reload.
Yours
php.ini and conf.d of each PHP version, .htaccess, .user.ini, your project files, your databases and everything outside the Hafen block in /etc/hosts are never touched.
PID files
At launch Hafen ends every process still listed in a PID file in run/ — also a database server or Apache you started yourself with Hafen’s configuration. Stop what you started by hand before you open Hafen again.
brew services
Homebrew’s services use their own configuration files, not Hafen’s, and Caddy as a service keeps its data elsewhere and creates a new certificate authority — trust its root.crt again. Copy Hafen’s Caddyfile to etc/Caddyfile in the Homebrew prefix first.
Hosts
The /etc/hosts block works on its own — leave it in place and the domains keep resolving without Hafen.

05 About

Not an on-ramp to anybody’s cloud.

Plenty of good local tools exist. Many of them are also the front door of a hosting company or need a container runtime in the background. Hafen is neither — it is a Mac app that runs upstream software, and that’s all.

Who stands behind the tool
ToolConnected to
LocalOwned by WP Engine
DevKinstaMade by Kinsta, a hosting provider
WordPress StudioMade by Automattic (WordPress.com)
DDEV, LandoA running Docker runtime (e.g. Docker Desktop, OrbStack)
HafenNothing. No account, no hosting upsell, no Docker.
Account
None. Download, open, add a project.
Runtime
Native macOS processes. No Docker, no VM, no container runtime.
Components
Plain upstream open-source builds you could also run by hand.
Config
Readable files: the generated Caddyfile, httpd.conf, one php-fpm.conf per version.

Where Hafen connects to

Hafen’s own downloads and update checks go to these upstream sources. Homebrew itself fetches packages from its own servers.

HomebrewCaddy, PHP, MariaDB, Apache, Mailpit, Xdebug — brew update & brew outdated
raw.githubusercontent.comThe official Homebrew installer script — only if Homebrew is missing and you agree to install it
cdn.mysql.comMySQL 8.4 LTS builds and their official .md5 checksums
formulae.brew.shLatest MySQL 8.4 version number (mysql@8.4)
api.github.com · github.comAdminer release lookup and download, verified via SHA-256
wordpress.orgWordPress core, when you import a .wpress backup

Why Hafen exists

Hafen started as a personal project. I wanted a tool I would actually use myself, shaped around my own requirements.

It was also an experiment in working with AI: Hafen was built in close collaboration with Claude, to see how well that works on a real app.

And it isn’t meant to be a black box that quietly arranges things in the background. Hafen should also give newcomers a look at how a setup like this can be put together by hand with open-source tools, so you can see what’s going on and learn from it.

Support the projects behind it

Hafen is only a thin layer on top of open-source software that other people build and maintain, often in their spare time. If Hafen is useful to you, please consider supporting these projects with a donation.

06 Features

The working parts of a PHP day.

Built for people who run a dozen client sites at once — some on PHP 8.5, some on 8.6, one legacy shop that still needs its .htaccess.

06.1

Projects & PHP

  • Own PHP version per project, any number of versions running side by side.
  • Per-project PHP settings: memory_limit, upload size (sets post_max_size too), max_execution_time, max_input_vars, display_errors.
  • Nested folders in the sidebar, drag & drop. Start or stop single projects or whole folders.
  • Decide what “Start all servers” includes — per folder, per project.
  • Apache per project, whenever code needs its .htaccess.
Project detail in light appearance: domains, document root, PHP version and settings, database credentials. Project detail in dark appearance: domains, document root, PHP version and settings, database credentials.
Fig. 2 Project detail — domains, PHP, database.

06.2

WordPress, properly

  • Caddy doesn’t read .htaccess, so Hafen rebuilds the WordPress rewrite rules in the Caddyfile.
  • Multisite, subdirectory and subdomain. Network domains are read from wp_blogs/wp_site and added to Caddy and /etc/hosts.
  • Import .wpress backups (All-in-One WP Migration) straight into a new project.
Importing a .wpress backup into a new project, light appearance. Importing a .wpress backup into a new project, dark appearance.
Fig. 3 WordPress — .wpress import into a new project.

06.3

Setup & updates in one place

  • Install Caddy, a database, PHP versions and the optional parts from one sheet.
  • Updates for Caddy, PHP, MariaDB, MySQL within 8.4 LTS and Adminer — one by one or all at once. Running services restart.
  • Checks at most once a day on launch, or whenever you ask.
  • Menu bar item, open at login, start servers automatically.
  • Uninstall PHP versions, Apache, Mailpit, Adminer and the database from the same sheet — blocked while a project still uses them.
  • Projects stay on this Mac unless you switch on local network access — see “Test on iPad & iPhone” below.
Setup sheet in light appearance: components installed via Homebrew and general settings. Setup sheet in dark appearance: components installed via Homebrew and general settings.
Fig. 4 Setup — components, general settings, updates.

06.4

Databases

  • Optional own database and user per project.
  • Export as .sql.gz or .sql; import into an emptied or the existing database.
  • “Unassigned databases” view for leftovers. Credentials are kept when you remove a project but keep its database.
  • “Open in Adminer” with automatic login.

06.5

Mail & debugging

  • Mailpit catches mail sent via PHP mail() or SMTP on port 1025, so test mails stay on your Mac. Mails are discarded when the servers stop.
  • Xdebug per PHP version, trigger mode, IDE on port 9003.
  • Logs per service, with a maximum size per log file; clear them one by one or all at once.

06.6

A Mac app

  • Swift & SwiftUI, Universal Binary for Apple Silicon and Intel.
  • English and German UI, following your system language.
  • Intel Macs: PHP compiles from source on install and update (20–40 min). Hafen tells you up front.

06.7

Test on iPad & iPhone

  • Switch on “Allow access from the local network” in Setup, and other devices on the same network can open your projects. Off by default: Caddy then answers only on 127.0.0.1/::1.
  • .local domains are announced via Bonjour. On the iPad or iPhone, open https://project.local — no Terminal, nothing to install on the device. With HTTPS, confirm the certificate warning once. .test domains stay local.
  • If the macOS firewall is on, Hafen allows Caddy itself (admin password once, again after Caddy updates) — no Terminal needed.
  • Switches itself off when your Mac joins a different network, such as café Wi-Fi; turn it on again deliberately there. Adminer and the database stay reachable from this Mac only.

07 Ports & paths

For the record.

Everything Hafen listens on and writes to. Ports 80 and 443 must be free — quit MAMP, Local, Valet and friends first. macOS only lets a regular user open those two ports on all interfaces, so Caddy drops every request that doesn’t come from this Mac. Projects reach the local network only if you switch that on in Setup.

Ports
PortServiceBound to
80, 443Caddy — HTTP & HTTPSall · LAN blocked unless enabled
2019Caddy admin APIlocalhost
90XYphp-fpm, one per version (8.6 → 9086)127.0.0.1
8480Apache httpd, behind Caddy127.0.0.1
3306MySQL 8.4 / MariaDB (default, adjustable)127.0.0.1
8090Adminer (default, adjustable)127.0.0.1
1025Mailpit SMTP127.0.0.1
8025Mailpit inbox127.0.0.1
9003Xdebug → your IDEIDE listens
Paths
~/Library/Application Support/Hafen/Config, database files, logs
…/Hafen/CaddyfileGenerated Caddy config
…/Hafen/apache/httpd.confGenerated Apache config
…/Hafen/php/8.6/php-fpm.confGenerated PHP-FPM config, per version
…/Hafen/mysql-dist/Official MySQL builds
…/Hafen/logs/One log per service
/etc/hostsManaged block, see below

/etc/hosts

# your own entries stay untouched
# BEGIN Hafen
127.0.0.1       client.test
::1             client.test
127.0.0.1       www.client.test
::1             www.client.test
# END Hafen

08 Get started

Four steps to the first https://

  1. Setup

    Install the parts

    Caddy, a database and the PHP versions you need. If Homebrew is missing, Hafen offers to install it.

  2. Toolbar

    Add a project

    Name, domains, document root, PHP version, HTTPS, optionally a database. macOS asks for your admin password to update /etc/hosts.

  3. Toolbar

    Start

    Caddy, the database and the PHP-FPM instances your projects need come up.

  4. Setup → Trust …

    Trust, once

    So your browsers accept the local certificate. That’s it — open https://client.test.

Hafen app icon: a white anchor above blue waves

Drop anchor.

Hafen for macOS. One app, all your local PHP projects, each in its own berth.

Requires
macOS 14 or later
Runs on
Apple Silicon & Intel
Languages
English, German
Before you start
Free ports 80 & 443