Skip to content

feat: stop and start Flock from the CLI and the macOS panel - #127

Open
timwrb wants to merge 1 commit into
flock-php:mainfrom
timwrb:feature/92-stop-flock
Open

timwrb wants to merge 1 commit into
flock-php:mainfrom
timwrb:feature/92-stop-flock

Conversation

@timwrb

@timwrb timwrb commented Nov 8, 2026 •

Copy link
Copy Markdown

Fixes #92

What and why

Quitting the menu bar or tray app leaves the daemon running, with every site, PHP worker and database. Until now the only way to stop it was launchctl bootout (or Stop-ScheduledTask on Windows). This adds a clean way, in the CLI on every platform and in the macOS panel.

 flock
   restart
+  start   # starts the daemon after `flock stop`; leaves a running one alone
+  stop    # stops the daemon and everything it runs
 Panel header
   (bird)  Flock
           Running · v1.0.0
+                                [on/off switch]
  • CLI. flock stop stops the daemon through each platform's service manager (launchd bootout, systemctl stop, ending the scheduled task), so it shuts down cleanly and stops everything it runs. flock start starts it again. On macOS, restartService now loads the agent again when it was unloaded, so flock restart also works after a stop.
  • macOS panel. A switch next to the logo turns Flock off and on. It replaces the "Flock is not running" text and the Start Flock button: when Flock is off, the panel shows only the header and the footer.
  • Until the next login. As suggested in Add a way to stop the Flock daemon (tray and CLI) #92, a stop lasts until flock start or the next login. Nothing is disabled.
  • Switch alignment. The Xdebug and Capture dumps switches move to the right edge, in one column with the new switch, like the Windows tray already has them (see the screenshots in fix(windows): polish settings and tray UI #123).
  • Docs. flock start and flock stop in docs/cli.md, and a "Stopping Flock" section in docs/installation.md.

Not in this PR: the Windows tray and the Linux app don't have the switch yet, but flock stop and flock start already work there. I'm happy to follow up with them, or to turn the switch into a Stop Flock item next to Restart (as #92 proposes) if you prefer that.

How I tested it

On macOS (Apple silicon), against a running Flock 1.0.0 with PostgreSQL, MySQL, Redis, php-fpm and a FrankenPHP site:

$ flock start
already running (pid 27489)
$ flock stop
stopped               # launchd job unloaded; no postgres, mysqld, redis, php-fpm or frankenphp left
$ flock start
started (pid 35399)   # flock status: every service up again
  • Turned the panel switch off and on again against the real daemon: Flock stopped, and came back with every service.
  • go test ./internal/cli passes, and GOOS=linux / GOOS=windows go vet ./internal/cli are clean. I haven't run it on Linux or Windows.
  • The screenshots are from FlockScreenshots with its demo data.
Before After After, switched off
image image image

@timwrb
timwrb marked this pull request as ready for review November 8, 2026 02:08

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a way to stop the Flock daemon (tray and CLI)

1 participant