Restore use of package-provided service files - #23423
Conversation
- Since #23312, `brew services start` always regenerated the service definition from the formula `service` block. Formulae that bundle their own service file only declare `name` there, so the generated plist had empty `ProgramArguments` and `launchctl bootstrap` failed with `Input/output error`. - Read the installed service file instead unless the `service` block defines a command, the same gate `FormulaInstaller#install_service` uses when writing generated service files into the keg. - Fixes #23408.
There was a problem hiding this comment.
Pull request overview
Restores brew services start/restart behaviour to use a formula’s package-provided plist/systemd unit when the formula’s service block does not define a run command, avoiding generation of invalid service definitions (e.g. empty ProgramArguments on macOS).
Changes:
- Update
FormulaWrapper#service_contentsto read the installed service file when there is noserviceblock or when the service block has no command, otherwise generate plist/unit content from the service block. - Add unit tests covering both generation paths (launchctl/systemd) and the package-provided fallback cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/services/formula_wrapper.rb | Makes service_contents fall back to reading the package-provided service file when no run command is defined. |
| Library/Homebrew/test/services/formula_wrapper_spec.rb | Adds coverage for service_contents generation and fallback behaviour. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Can someone please provide a timeline for the next release containing this fix? This bug wasted hours for me yesterday and today trying to troubleshoot why Homebrew wouldn't start the I am not able to downgrade Homebrew and have it still function in the way I need, so this is a serious issue. |
|
@ogiarch We'll likely tag a new release on Monday. |
brew services startalways regenerated the service definition from the formulaserviceblock. Formulae that bundle their own service file only declarenamethere, so the generated plist had emptyProgramArgumentsandlaunchctl bootstrapfailed withInput/output error.serviceblock defines a command, the same gateFormulaInstaller#install_serviceuses when writing generated service files into the keg.Fixes #23408
Closes #23413
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Fable 5 Max with local review and testing.