Kill Duplicate Process?

Every now and then I'll notice my Logitech MX Master does things twice. For example, if I use one of the buttons to close the front window, it will close the front two. I then look and see that there are two instances of LogiMgrDaemon running. I have no idea why and I've tried uninstalling and reinstalling Logi Options.

I was wondering if I could run a macro on wake that checks to see if there is more than one instance of this process running; if so, it will kill one of them. The killing bit is easy. What I'm unsure about is how to count instances of a particular process. Any help appreciated.

Have you tried killing them all and seeing if launchd relaunches a single process?

Otherwise a simple, if long-winded, way to get a count would be

ps -ax | grep "LogiMgrDaemon" | grep -v grep | wc -l
1 Like

Is that the login items thing? If so, I guess I'd kill them all then restart?

Using your suggestion, I think this will work, but I won't know until it goes wrong again and I'm not sure what causes it.

Unless I'm mistaken, killall doesn't actually kill all processes with that name; it kills the first one that receives the message... but I've been mistaken before!

Depends -- if LogiMgrDaemon has registered itself in launchd as something "to be relaunched if ever quit" then yes. If you can find the plist, see if there's a KeepAlive key.

Or just kill it and see what happens (go on, you know you want to...).

It should kill any process that matches. But check in Activity Monitor as to who owns the process (I wonder -- maybe you are getting two instances because one is yours and the other root's?) as you may have to sudo (along with all the sudoers setup you know so well).

You can test-flight killall with the -d switch. I've got two systemstats process running at the moment, both owned by root so I have to sudo, and get:

% sudo killall -d "systemstats"
Password:
nprocs 566
sig:15, cmd:systemstats, pid:959, dev:0xffffffffffffffff
sig:15, cmd:systemstats, pid:528, dev:0xffffffffffffffff
%

OK -- weirdly, I've got a whole bunch of tails running. Let's find out...

% killall -d "tail"       
uid:502
nprocs 382
sig:15, cmd:tail, pid:52305, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52289, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52276, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52248, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52165, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52068, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52040, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52025, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:52013, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51997, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51983, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51874, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51803, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51665, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51663, dev:0xffffffffffffffff
sig:15, cmd:tail, pid:51483, dev:0xffffffffffffffff
% killall "tail"   
% killall -d "tail"
uid:502
nprocs 366
No matching processes belonging to you were found
%

Boom!

3 Likes

@noisneil Just bought the same mouse. And saw that the duplicate thing seems to be a Rosetta problem.
Is this a fix?

1 Like

I'm on Intel/Ventura so not for me.