DEV Community

Discussion on: Controlling photoanalysisd

Collapse
 
gordonaspin profile image
Gordon Aspin

I think a more permanent solution is to disable the photoanalysisd service entirely. The service runs in the launchd user domain, so to disable it:

launchctl disable user/$(id -u)/com.apple.photoanalysisd

and re-enable:
launchctl enable user/$(id -u)/com.apple.photoanalysisd

and to check disabled status look at the JSON "disabled services" output of:
launchctl print user/$(id -u)

Even more simply, you could find and delete (or move) its plist file:
sudo mv /System/Library/LaunchAgents/com.apple.photoanalysisd.plist

Collapse
 
gjbianco profile image
Guy Bianco IV

If you look again, I actually do disable it as part of the cron. The problem is that something in the OS re-enables that service every so often. Running it once is not actually permanent.

Removing the plist should also work, but I didn't want to (re)move anything tied into the system.

Collapse
 
gordonaspin profile image
Gordon Aspin

I missed that, you do disable it but only in the gui context which is created every time the user logs in and why it keeps be “re-enabled”. Your disable is only for the current GUI login. The OS is behaving as designed.

If you disable it in the user context, it will never be started again. Once and done :)

launchctl disable user/$(id -u)/com.apple.photoanalysisd

Thread Thread
 
gjbianco profile image
Guy Bianco IV

That's quite a bit nicer! Testing it out currently and will update the article once I'm satisfied it worked (not that I doubt you, just want to make sure).

Thread Thread
 
santafearttweet profile image
incidental intention

Hi Guy,
all this code stuff is unknown to me. I was using a command in Terminal to stop photoanalysisd that I found somewhere. It only works temporary and photoanalyssid take up over 90% of my CPU per activity monitor. Could you please give me instructions where I enter: launchctl disable user/$(id -u)/com.apple.photoanalysisd
I am not fmailiar with any of these procedurea and do not understand code at all. Is there a way to guide me through this in a simple way?
Thanks, Walter

Thread Thread
 
gjbianco profile image
Guy Bianco IV

I've updated the article to reflect the advice from Gordon. You should be able to run the commands provided in Terminal like you've been doing. You should only have to run them once, however! Hope this helps :)

Thread Thread
 
santafearttweet profile image
incidental intention

Thank you very much.
I'll try this.
Sorry, I had a lot of typos in my previous post!
Thanks