Hi! I’m using home-manager on macOS and I’m looking to write a custom launchd agent.
The context is that I’m ditching Docker Desktop for colima, which doesn’t start automatically.
My configuration seems fine by itself, the first time worked fine, but home-manager’s reload process is very weird.
Whenever I switch home-manager with an update to the config, I’m getting the following error:
Activating setupLaunchAgents
Setting up LaunchAgents in /Users/laggron/Library/LaunchAgents
Processing new/updated LaunchAgents...
Processing agent 'org.nix-community.home.colima'
Stopping agent 'gui/501/org.nix-community.home.colima'...
Installing agent file to /Users/laggron/Library/LaunchAgents/org.nix-community.home.colima.plist
Starting agent 'gui/501/org.nix-community.home.colima'
Failed to start agent 'gui/501/org.nix-community.home.colima' with I/O error (code 5)
This typically happens when the agent wasn't unloaded before attempting to bootstrap the new agent.
Cleaning up removed LaunchAgents...
Agent 'org.nix-community.home.colima' still exists in new generation, skipping cleanup
In my logs, I can see the application shutting down, but it never comes back up.
The workaround I found, as hinted by the error, is to run launchctl load ~/Library/LaunchAgents/org.nix-community.home.colima.plist then launchctl unload ~/Library/LaunchAgents/org.nix-community.home.colima.plist. Finally, I can rerun home-manager switch and the service comes back up.
Do you have any idea of what I could be missing for this to happen?
My configuration is available here.