Macro to Kill a Specific Process – accountsd

Hello. Mail under 10.15.4 is still a PITA. What tends to work for me – at least for a while – is killing the accountsd process.

I found a terminal command in an earlier post here and modified it to look like this, but it gives the result shown.

Last login: Sat May 16 01:42:58 on ttys000
aland@al-72 ~ % aland ALL= NOPASSWD: /usr/bin/killall accountsd, !/usr/bin/killall accountsd *
zsh: event not found: /usr/bin/killall
aland@al-72 ~ %

Any revision appreciated – thanks! (last thing I coded was hypercard…)

Ok. So your terminal command looks like some kind of mashup between a couple of different things.

Let's start from with the killall command. Before we do anything with that command, it's a good idea to know what it's going to kill. For that we run this command:

pgrep -fl accountsd

which, on my computer, shows this:

515 /System/Library/Frameworks/Accounts.framework/Versions/A/Support/accountsd
613 /System/Library/PrivateFrameworks/AppleMediaServices.framework/Resources/amsaccountsd

The second one is amsaccountsd not accountsd so I'll assume that you want to get rid of that one. So let's try pgrep -fl '/accountsd' which gives us this:

515 /System/Library/Frameworks/Accounts.framework/Versions/A/Support/accountsd

Ah, ok, so now we now how to target the right one. Instead of using killall we can use pkill which works the exact same way as pgrep:

pkill -fl '/accountsd'

Assuming that does what you want, then you'd probably just want a Keyboard Maestro macro that runs a shell script and have it run:

/usr/bin/pkill -fl '/accountsd'

and check to make sure that the exit code of that command is zero.

If you wanted to get fancy you could do something like this:

#!/usr/bin/env zsh -f


pkill -fl '/accountsd'


if [[ "$EXIT" == "0" ]]
	echo "Success"
	exit 0

	echo "Failure (\$EXIT = $EXIT)"

	exit 1


Which will give you an error code (1) if it doesn't work and '0' if it does, and also a bit more to go on if it doesn't work.

The other part…you don't need.

As for the part of the command:

ALL= NOPASSWD: /usr/bin/killall accountsd

that would be something that you would enter into the sudoers file so you could run it with sudo without having to enter your password. You don't need to use sudo for this, so I recommend you just ignore that entirely.

Let me know if you need more info about any of this. Be glad to help.

1 Like

a bit off topic but i had the same issue on catalina and this solved it for me:

Disable automatically connection setting of Mail account

a). Open the Mail Preferences

b). Go to "Accounts" and select your Provider/Account

c). Click Server Settings (the last right tab)

d). Disable the Automatically manage connection settings (checkbox)

Disable automatilly connection setting of Apple Mail account

1 Like

Hello tj
Thanks so much for this but I'm well out of my depth. But you're right – just looking for a simple headless command that I can run in KBM; after testing I really don't need or want any feedback.

Here's what just happened – damn thing didn't quit :frowning:

Any thoughts appreciated!


Thanks z

I've got multiple account spanning everything from iCloud to Gmail to MS but will surely try it.

Appreciate the note – glad it worked for you. Things are so bad here that I'm trying Airmail (and Postbox and Spark – but can't bring myself to fire up Outlook…)



That is a sudoers line. It must be placed in the /etc/sudoers file. Replace “aland” with your username.

Edit the file (using sudo in the Terminal and a terminal editor like vim or whatever) and add the line to the end of the file.

Use with care, you are opening up security holes and messing with things best left unmessed with unless you know what you are doing (I have a similar line in my sudoers file for killing coreaudiod, although that no longer seems to be necessary).

Then you can run the command:

sudo /usr/bin/killall accountsd

which will run the command as root, which probably will kill the process.

Whether this is a good idea or not I have no idea.

But that appears to be the instructions you are trying to follow.

Hope you don't mind me chiming in with a similar issue. Since moving to Catalina and onto a 16" MBP, my system is plagued by pkd and lsd processes slowing performance to a grinding crawl, for reasons nobody seems to be able to explain.

Anyway, I've been using Alfred to search for each process and kill it; lsd for some reason often needs to be killed more than once (multiple processes with the same name, I suppose). Obviously this is quite tedious, so I'd love to have a hotkey that kills all processes named 'lsd' or 'pkd'.

Might I be able to string together a script based off the one you arrived upon here?

There is a nice little utility called app tamer that can be used to easily control processes like that.

Works great and not very expensive either. Made by St. Claire software, who also makes Default Folder.

You can throttle individual apps very easily and as a benefit you can speed up time machine backups.

I has a free 15 day trial too.

Screen Shot 2020-11-06 at 3.13.49 PM

Funnily enough, I contacted Jon at St Claire Software and he added a feature that kills runaway processes just for me and it's now a permanent feature of AppTamer. Works perfectly!


Jon Gotow is a good guy.

I've used Default Folder for decades, and I own licenses for AppTamer, and HistoryHound as well.