Skip to content

LaunchDaemons show as generic 'sh' in macOS Login Items due to /bin/sh -c pattern #1678

@paixaop

Description

@paixaop

Description

On macOS, the System Settings → General → Login Items & Extensions panel displays LaunchDaemons by their executable name. Because nix-darwin's core services use /bin/sh -c "..." to wait for the Nix store before executing, they all appear as generic "sh" entries labeled "Item from unidentified developer."

This makes it difficult for users to identify what these services are, especially when multiple "sh" entries appear with no distinguishing information.

Current Behavior

The following services all show as "sh" in Login Items:

  • org.nixos.nix-daemon
  • org.nixos.darwin-store
  • org.nixos.activate-system
  • org.nixos.nix-optimise

Example plist (nix-daemon):

<key>ProgramArguments</key>
<array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>/bin/wait4path /nix/store &amp;&amp; exec /nix/store/.../bin/nix-daemon</string>
</array>

Expected Behavior

Services should appear with descriptive names like "nix-daemon", "darwin-store", etc., so users can easily identify them in macOS System Settings.

Proposed Solution

Create named wrapper scripts in the Nix store that handle the wait4path logic, then reference those scripts in ProgramArguments:

# Wrapper script derivation
nix-daemon-wrapper = pkgs.writeScriptBin "nix-daemon-start" '
  #!/bin/sh
  /bin/wait4path /nix/store && exec ${config.nix.package}/bin/nix-daemon
';

# In the launchd plist
ProgramArguments = [ "${nix-daemon-wrapper}/bin/nix-daemon-start" ];

This would make macOS display "nix-daemon-start" (or similar) instead of "sh".

Environment

  • macOS: 26.2 (Tahoe)
  • nix-darwin: 9f48ffaca1f44b3e590976b4da8666a9e86e6eb1
  • Nix: 2.29.0

Additional Context

The same issue affects the Determinate Systems installer's systems.determinate.nix-installer.nix-hook service, which would need a similar fix upstream in that project.

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