ICloud – Delete (not hide) calendar events automatically or via CLI

calendaricalicloud

There are many answers online on how to hide old events from iCloud calendars, but not many on how to actually delete them. From the settings, it appears to not be possible to do automatically. There may be, however, a command-line way to do it. I’m looking for something that doesn’t rely on AppleScript to call the Calendar app and doing it there, as I’ve gotten mixed results with such solutions, and would rather not invoke a GUI.

Best Answer

Since iCloud is based on CalDAV, this shouldn’t be too hard. Deleting an event boils down to a simple HTTP request, e.g.:

DELETE /calendars/johndoe/home/132456762153245.ics HTTP/1.1
If-Match: "2134-314"

This project on GitHub could serve as a good starting point: jcs/iclouddav