Skip to content

homebrew: Restarting services does not work when darwin-rebuild is run from launchd daemon #1821

Open

Description

@phlmn

Hi there, I've built a tool to watch a git repo and run darwin-rebuild on changes. Unfortunately I get an error when the homebrew module tries to restart a brew service.

In my nix-darwin config I've added node_exporter via homebrew:

{ pkgs, config, ... }:
{
  homebrew.brews = [
    {
      name = "node_exporter";
      restart_service = true;
      start_service = true;
    }
  ];
}

I'm able to run darwin-rebuild without any problem by hand, but as soon as I run it via my tool (pulld), I receive this error:

Using node_exporter
Installing node_exporter has failed!
`brew bundle` failed! 1 Brewfile dependency failed to install
Warning: running through sudo, using user/* instead of gui/* domain!
Hide this warning by setting `HOMEBREW_SERVICES_NO_DOMAIN_WARNING=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap user/501 /Users/admin/Library/LaunchAgents/homebrew.mxcl.node_exporter.plist` exited with 5.

Now when I stop the service (brew services stop node_exporter) pulld works until I run darwin-rebuild by hand again or restart the computer.

I'm a bit confused about this since I run darwin-rebuild with sudo and the pulld service runs as root.

For reference, this is the launchd service: https://github.com/phlmn/pulld/blob/af8bc0d7aa7b82281b3c99542eab0b1e891f44e5/nix/pulld-service-darwin.nix

I'm using latest nix-darwin-26.05 (adda04f).
homebrew version is 6.0.6.

Might be related to #1212

Activity

  1. changed the title [-]homebrew: Restarting services does not work when darwin-rebuild is run from launchd daemon[/-] [+]homebrew: Restarting services does not work when `darwin-rebuild` is run from launchd daemon[/+] on Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions