Skip to content

Restore use of package-provided service files - #23423

Merged
MikeMcQuaid merged 1 commit into
mainfrom
restore-services-plist
Aug 4, 2026
Merged

Restore use of package-provided service files#23423
MikeMcQuaid merged 1 commit into
mainfrom
restore-services-plist

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Since Add per-service user environment variable overrides #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
Closes #23413


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Fable 5 Max with local review and testing.


- 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.
Copilot AI lite review requested due to automatic review settings August 4, 2026 08:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_contents to read the installed service file when there is no service block 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.

@MikeMcQuaid
MikeMcQuaid enabled auto-merge August 4, 2026 09:46
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Aug 4, 2026
Merged via the queue into main with commit 5321c76 Aug 4, 2026
44 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the restore-services-plist branch August 4, 2026 10:05
@ogiarch

ogiarch commented Aug 6, 2026

Copy link
Copy Markdown

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 mongodb-community service properly.

I am not able to downgrade Homebrew and have it still function in the way I need, so this is a serious issue.

@MikeMcQuaid

Copy link
Copy Markdown
Member Author

@ogiarch We'll likely tag a new release on Monday.

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.

brew services no long use the package-provided service file after #23312

4 participants