First Aid Error Exit Code 8
For some weeks I have been trying to solve a problem with my mid-2011 iMac running on OS X 10.12.6. After running without problems for ~9 years it suddenly started to respond very slowly and occasionally crashed but worked again normally on rebooting. However, running First Aid it always failed at the stage of checking catalog file with the Error Exit Code 8. Restarting in the Safe Mode First Aid always gave the same result but restoring from my Time Machine HD always restores perfectly and Exit Code 0 after running First Aid. Unfortunately this only lasted for various intervals of time. I think I have exhausted all the manoeuvres to try to remedy the corruption. I have completely erased the HD; re-installed OS X 10.12.6; removed all unwanted apps and apps that have a reputation for causing problems, checked that In don't have malware, run First Aid after using each of the apps that I use on a regular basis to check that the Exit Code 8 hasn't reappeared.
One fact that may be coincidental, is that the problem occurred at the time we acquired a new iPad 13.4.1and we turned on the 2-factor ID system and I started to suspect that it may be due to sharing Photos. My iMac started with 10.7 and so had iPhoto which was merged with Photos when I upgraded OS X. Certainly, when I switched Photos of in my iCloud drive option on the iMac, the problem of Exit Code 8 cropped up less frequently but unfortunately still happensens. Although I am now clutching at straws, it seems that the problem now always occurs when I am using Mail. I use Mac Mail and as with the iPhoto > Photos with the upgrades I was switched from @.mac.com (Mobileme) to @me.com or @icloud.com. Does any of this make any sense to anybody and if so do you have any solutions? Just one final point, in between times my iMac runs as if it is bran new so I am assuming that it is a file corruption and not a hardware problem but I am probably being naive!
iMac 21.5", macOS 10.12