Mutagen v0.10.0 questionJuly 30, 2019 at 9:50am
Hi! In my first words here, I'd like to express how much I appreciate your job, the application and how it's developed. We're switching to mutagen from unison, where mutagen will be used in our local project python launcher (we all work on OSX). Mutagen is just what we needed, something like a fresh breath while we fought with docker/osx/unison :D
Now the question!
We're randomly getting this message: /Users/jmaciejewski/Library/LaunchAgents/io.mutagen.mutagen.plist: service already loaded
No daemon command are invoked, only mutagen create/resume/pause
Is this some kind of bug which will be resolved? Thank you for your answer
July 30, 2019 at 2:19pm
I'm not able to replicate this issue step by step, but it happens randomly, when sync sessions are running, and you try to invoke 'mutagen list':
mutagen listAttempting to start Mutagen daemon... /Users/jmaciejewski/Library/LaunchAgents/io.mutagen.mutagen.plist: service already loadedStarted Mutagen daemon in background (terminate with "mutagen daemon stop")--------------------------------------------------------------------------------Identifier: 4e4826b6-126d-4bda-988b-8b7d4d7eaba1
Looks like mutagen daemon is freezed/stopped for a while.
July 30, 2019 at 10:53pm
Hey , thanks for the kind words!
io.mutagen.mutagen.plist: service already loadedmessage is coming from
launchd, though I'm not exactly sure why.
Just for some background: In Mutagen v0.10.0 and later,
create/list/monitor/flush/pause/resume/terminatecommands have been modified to automatically start the daemon if it's not already running. This is meant to be a convenience, but it can be disabled if not desired (by setting
MUTAGEN_DISABLE_AUTOSTART=1in the environment). So the reason that you're seeing these errors when invoking
listis that Mutagen is trying to automatically start the daemon.
On macOS, Mutagen starts the daemon differently depending on whether or not
mutagen daemon registerhas been used. If it has, then Mutagen will attempt to invoke daemon startup through
launchd, which should work fine, but for some reason it seems to be having trouble in this case.
Can you check that the path to the Mutagen executable in
~/Library/LaunchAgents/io.mutagen.mutagen.plistis correct? If you changed the location of the
mutagenexecutable (maybe by uninstalling from Homebrew and manually installing elsewhere?), then the
plistmight have an outdated path, and that might cause the error above.
If that's the case, you can do the following:
mutagen daemon stopmutagen daemon unregistermutagen daemon register
(don't worry if
mutagen daemon stopprints an error)
That should fix the path, and then the next time you run
mutagen daemon startor any other command, the daemon should start correctly. The
launchddaemon startup mechanism is a little experimental/fragile. I'm hoping it won't be a long-term solution (I think a little tray icon app would be better), but at the moment it's the only way to enable synchronization on system startup. If you don't need the daemon to run at system startup, I would just avoid using
launchd, especially now that daemon startup is mostly automatic.
Let me know if that doesn't help and we can debug further. One thing you might also look at is the new daemon embedding support in v0.10.0. It allows you to create an isolated daemon instance that's just for your project. The Mage2click developers are doing something similar. I think this might become a more popular use case for projects looking to embed Mutagen.