Recently at my job the macOS Calendar has been having problems properly syncing with the Exchange server, likely due to a corrupt attachment. I came across this post by Michael Kummer detailing the steps to resolve the problem I had encountered. I went through all of the listed steps and it corrected the problem. Calendar resynced itself and the annoying warning disappeared.
Well, for a little while, at least.
The problem popped up again. Unfortunately, I haven't determined which particular event is causing the conflict, but for the time being, I had to go through all of the steps again. But if this is liable to happen again, the situation invites itself as an opportunity for a little scripting to simplify the process.
I whipped up the following bash script which performs four steps:
- Quit the Calendar app
- Delete all of the Calendar cache files
- Kill all running processes related to the Calendar
- Restart the Calendar app
Remember to set the executable permission on the script via chmod 755 clear_calendar_cache.sh
. To make things even quicker, an alias can be set up in your shell so the script can be quickly run from anywhere in the Terminal.