@Command(name="install",description="Install as launchd service (macOS)")publicclassInstallMacOsCommandextendsBaseCommand{@Option(names={"--user"},description="Install as user agent instead of daemon")privatebooleanuserAgent;@OverridepublicIntegercall(){// 1. Generate plist file// 2. Copy to appropriate location// 3. Run launchctl load}}
4. Uninstall Command
@Command(name="uninstall",description="Uninstall launchd service (macOS)")publicclassUninstallMacOsCommandextendsBaseCommand{@OverridepublicIntegercall(){// 1. Run launchctl unload// 2. Remove plist file}}
5. Launchctl Operations
publicclassLaunchdManager{publicvoidload(PathplistPath){exec("launchctl","load",plistPath.toString());}publicvoidunload(PathplistPath){exec("launchctl","unload",plistPath.toString());}publicbooleanisLoaded(Stringlabel){// launchctl list | grep label}publicvoidstart(Stringlabel){exec("launchctl","start",label);}publicvoidstop(Stringlabel){exec("launchctl","stop",label);}}
6. Service Status Integration
barn service status should detect launchd:
Barn Service Status
==================
Status: running (launchd managed)
...
7. Tests Required
LaunchdManagerTest.java: Test launchctl operations (mock)
InstallMacOsCommandTest.java: Test plist generation
@daniel-samson commented on 2026-01-21 15:08:48 UTC:
Implemented macOS launchd integration:
LaunchdManager class for launchctl operations
ServiceInstallCommand for installing as launchd service
ServiceUninstallCommand for removing launchd service
Updated ServiceStatusCommand to show launchd managed status
Tests for LaunchdManager and commands
Build passes with mvn verify
<!-- github-import:comment:3778653058 -->
_**@daniel-samson** commented on 2026-01-21 15:08:48 UTC:_
Implemented macOS launchd integration:
- LaunchdManager class for launchctl operations
- ServiceInstallCommand for installing as launchd service
- ServiceUninstallCommand for removing launchd service
- Updated ServiceStatusCommand to show launchd managed status
- Tests for LaunchdManager and commands
- Build passes with mvn verify
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Imported from GitHub samson-media/barn#17 — opened by @daniel-samson on 2026-01-21 12:41:23 UTC
Overview
Implement macOS launchd integration for running Barn as a system service.
Context
README.md(cross-platform support)Requirements
1. Launchd Plist File
/Library/LaunchDaemons/com.samsonmedia.barn.plist(system-wide):2. User Agent (Alternative)
~/Library/LaunchAgents/com.samsonmedia.barn.plist(per-user):Same format but runs as user instead of root.
3. Installation Commands
4. Uninstall Command
5. Launchctl Operations
6. Service Status Integration
barn service statusshould detect launchd:7. Tests Required
LaunchdManagerTest.java: Test launchctl operations (mock)InstallMacOsCommandTest.java: Test plist generationAcceptance Criteria
barn service installinstalls on macOSbarn service uninstallremoves cleanlymvn verifypassesImplementation Notes
Detect if running under launchd:
Plist locations:
/Library/LaunchDaemons/(requires sudo)~/Library/LaunchAgents/(no sudo)Definition of Done
@daniel-samson commented on 2026-01-21 15:08:48 UTC:
Implemented macOS launchd integration: