Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.

add-on registry tests last commit release

DDEV Autostart

Overview

Adds a global ddev autostart command that starts your DDEV projects automatically: at boot on Linux, and when you log in on macOS. Each project is registered separately, so you choose exactly which ones come up on their own, or register everything you have running with a single ddev autostart enable --running.

Requirements

On Linux:

On macOS:

Installation

Run this from inside any DDEV project (or add --project <name> from anywhere):

ddev add-on get asiby/ddev-autostart

No restart is needed. The command is installed into DDEV’s global directory (~/.ddev).

To update to the latest version, run the same command again from the project you installed it from. If you don’t remember which one, ddev autostart status tells you at the bottom.

Usage

Command Description
ddev autostart enable [project...] Start projects automatically
ddev autostart enable --running Start every project that is running right now automatically
ddev autostart enable --registered Update every registration, after updating the add-on or moving docker or ddev
ddev autostart disable [project...] Stop starting projects automatically (they keep running)
ddev autostart disable --all Stop starting every project automatically
ddev autostart status [project...] Show whether projects are registered and whether they started
ddev autostart list Show every project and its autostart state
ddev autostart --version Show the installed version (include it in bug reports)

Tab completion works for the actions, their options and project names (after disable, only the projects you’ve registered).

Inside a project folder, the project name is detected automatically:

cd ~/code/my-site
ddev autostart enable

Anywhere else, give one or more project names:

ddev autostart enable site-a shop blog

If any name is wrong, nothing is changed. To make your current setup come back after every reboot or login, register whatever is running:

ddev autostart enable --running

--running asks DDEV which projects are running, so Docker must be up.

After updating the add-on, run ddev autostart enable --registered so existing registrations get the changes. Each one keeps the Docker settings it was registered with (DOCKER_HOST, DOCKER_CONTEXT, DOCKER_CONFIG, DDEV_XDG_CONFIG_HOME); to change those, run ddev autostart enable <project> from a shell that has the new ones. It only rewrites registrations that systemctl or launchctl report as turned on, and skips those reported as off or that it can’t read at that moment, as well as projects it can’t find. On macOS, switching an entry off in System Settings doesn’t show in launchctl, so --registered still rewrites it.

ddev autostart list gives an overview of all your projects:

PROJECT  AUTOSTART  SERVICE   DDEV     APPROOT
blog     disabled   -         stopped  /home/me/code/blog
shop     enabled    failed    stopped  /home/me/code/shop
site-a   enabled    active    running  /home/me/code/site-a

list also prints a reminder for orphaned or failed registrations.

Supported platforms

Platform Status
Linux with systemd (Ubuntu, Debian, Fedora, Arch, …) ✅ Supported
Linux with OpenRC (Alpine, Gentoo) Help wanted (see Contributing)
macOS (launchd) ✅ Supported (starts at login)
Windows Help wanted (see Contributing)

How it works (Linux / systemd)

enable writes a system service at /etc/systemd/system/ddev-autostart-<project>.service, which is why it needs sudo. The service:

It runs only once, at boot. If Docker is stopped or restarted later, your projects stop with it and stay stopped until you run ddev start.

Registrations belong to the Linux user who made them. On a shared machine, other users’ registrations are left alone by every command, including uninstalling.

enable doesn’t start the project now, and disable doesn’t stop it; they only change what happens at the next boot. To try a project’s boot service without rebooting:

sudo systemctl start ddev-autostart-<project>.service

The service records where ddev and docker are installed, and adds only those folders to the standard system ones. If you move or reinstall either to a different location, the service fails and its log says so; run ddev autostart enable --registered to update every registration. Normal upgrades (apt, Homebrew, ddev self-upgrade) keep the same location and need nothing. The same goes for macOS, for example after switching between Docker Desktop and OrbStack.

How it works (macOS / launchd)

On macOS, Docker runs as your user and only starts once you log in, so projects start at login too. enable writes a LaunchAgent at ~/Library/LaunchAgents/ddev-autostart.<project>.plist, so no sudo is needed. When you log in, it:

macOS lists each registered project in System Settings → General → Login Items & Extensions, under App Background Activity (called Allow in the Background before macOS 26), as ddev-autostart-<project>, marked “Item from unidentified developer”. Leave it switched on. Projects registered before v0.5.2 show up as sh until you run ddev autostart enable --registered; they keep working either way.

The entry runs a small launcher, ~/Library/Application Support/ddev-autostart/ddev-autostart-<project>, which disable removes along with the LaunchAgent.

As on Linux, it runs only once, and enable and disable don’t start or stop the project. To try it without logging out, run the command ddev autostart status <project> shows next to “Try it”.

Troubleshooting

A project didn’t start. ddev autostart status <project> shows the last result, and the log shows why:

journalctl -u ddev-autostart-<project>.service -b      # Linux
cat ~/Library/Logs/ddev-autostart/<project>.log        # macOS

Common causes: Docker took more than about 2 minutes (Linux) or 5 minutes (macOS) to start, your user isn’t in the docker group, lingering is off with rootless Docker or Podman, Docker isn’t set to start at login (macOS), or the project itself fails to start (try ddev start <project> by hand).

macOS: the project didn’t start at login, and its log has no entry for that login. macOS lists login jobs in System Settings, under General → Login Items & Extensions → App Background Activity (Allow in the Background before macOS 26). This one shows up there as ddev-autostart-<project> (as sh if it was registered before v0.5.2). If it was switched off, switch it back on. ddev autostart list can’t see that switch, so it still shows the project as enabled. If it was removed, register the project again with ddev autostart disable <project> then ddev autostart enable <project>. If status says the last result failed but the log is empty, launchd couldn’t run the job: the project folder was moved, deleted, or is in a protected folder (see below), or the add-on’s files were deleted without uninstalling it (reinstall it, then run ddev autostart enable --registered).

The log says docker or ddev “is not there any more”. It was moved or uninstalled since the project was registered, for example by switching between Docker Desktop and OrbStack or Colima, or by installing DDEV another way. Run ddev autostart enable --registered to record where they are now.

The log says “Not trying to add hostnames to hosts file”. This line is always there and is normal: at boot or login there’s no one to type a sudo password, so DDEV skips /etc/hosts and starts the project anyway. Names under ddev.site work once the computer is online; a custom hostname that needs a hosts entry needs one ddev start from a terminal first.

macOS: the log says “Operation not permitted”. macOS protects Desktop, Documents and Downloads, and may not let a login job use a project there even though it works from Terminal. Move the project to another folder, such as ~/Sites.

list shows a project as orphaned. The project was deleted or renamed while registered, so its autostart service fails every time. Remove it with ddev autostart disable <project>. DDEV doesn’t tell add-ons when a project is deleted, so run disable before ddev delete when you can. Removing the entry in Login Items only stops it from running; disable removes its files.

Uninstalling

Remove the add-on from the same project you installed it from (DDEV keeps the add-on’s install record in that project). If you don’t remember which one, ddev autostart status or ddev autostart list tells you at the bottom:

ddev add-on remove ddev-autostart

Before deleting the command, uninstalling removes the autostart registration of every project, so nothing keeps starting afterwards. On Linux, it asks for your sudo password if needed. Where no password can be entered (for example in a script with no terminal), it leaves the registrations in place and prints the exact commands to remove them.

Contributing

Each operating system is a plugin in commands/host/autostart.d/plugins/, so support for a new system is mostly one file. I don’t have an OpenRC or Windows system to test on, so plugins for those are especially welcome. See CONTRIBUTING.md for the plugin contract, what every plugin must handle, and how to test.

Credits

Contributed and maintained by @asiby, with help from Claude (Anthropic) and reviews by ChatGPT and Perplexity.

If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.