Environment
- smctl 0.1.8 (Homebrew,
brew install leaperone/smctl/smctl)
- MacBook Pro (M5 Pro), macOS 26 (Darwin 25.4.0)
Repro
$ sudo smctl daemon install
Error: Could not find smctld next to the current smctl executable.
Works fine with an absolute path:
$ sudo /opt/homebrew/bin/smctl daemon install
Installed smctld at /Library/LaunchDaemons/one.leaper.smctl.daemon.plist
Cause
DaemonInstall.currentSmctldPath() resolves the binary location from CommandLine.arguments[0]. When the command is found via PATH lookup, argv[0] is just smctl (not absolute), so the code falls back to cwd + "smctl" and looks for smctld in the current working directory.
Suggested fix
Resolve the real executable path with _NSGetExecutablePath (plus realpath to keep symlink behavior intentional) instead of trusting argv[0]. Note: with the Homebrew layout, resolving through the /opt/homebrew/bin/smctld symlink vs the Cellar path changes what the LaunchDaemon plist points at across upgrades — pointing at the symlink survives brew upgrade, the versioned Cellar path does not.
Happy to provide more details — found while setting up on a real machine.
Environment
brew install leaperone/smctl/smctl)Repro
Works fine with an absolute path:
Cause
DaemonInstall.currentSmctldPath()resolves the binary location fromCommandLine.arguments[0]. When the command is found via PATH lookup,argv[0]is justsmctl(not absolute), so the code falls back tocwd + "smctl"and looks forsmctldin the current working directory.Suggested fix
Resolve the real executable path with
_NSGetExecutablePath(plusrealpathto keep symlink behavior intentional) instead of trustingargv[0]. Note: with the Homebrew layout, resolving through the/opt/homebrew/bin/smctldsymlink vs the Cellar path changes what the LaunchDaemon plist points at across upgrades — pointing at the symlink survivesbrew upgrade, the versioned Cellar path does not.Happy to provide more details — found while setting up on a real machine.