Posts in tag "iCloud"
Yesterday I accidentally deleted my calendar. My primary calendar. You know, the one which stops me from forgetting all the things I've promised people I'd do. It's kinda a big deal for me.
I'm not sure exaclty how I did it, but I'm relatively sure it involved some overzealous keyboard mashing (typing), not looking at what I was doing and absentmindedly hitting enter when the "Are you sure?" dialog popped up. In any case, it wasn't until Emma asked me why I'd stopped sharing it with her did I clock it had disappeared.
I luckily had a TimeMachine backup running at work, so I didn't stress too much as I assumed (wrongly) that I'd be able to easily ressurect it from that. However, iCal doesn't seem to behave like Finder (or other apps, like Mail) does and individually pulling back calendars or events doesn't seem to be a thing.
TL/DR: I managed to restore my calendar in the end. I think. It definitely feels like all the events are there, but I can't be sure.
Here's how I worked it out:
Finding the original events
The first step in restoring my calendar was locating the library folder in my backup. This was found at
~/Library/Calendars; after some clicking about in the generated folders I eventually found what looked to be my missing events. Hoorah!
I eagerly restored the folder, expecting iCal to quietly realise it was there and sync it all up again. Incorrect. Nothing happened.
Importing into a new calendar
The next step in my thought process was to create a new calendar and drag all the
.icsfiles in, surely iCal would notice the batch import and ask me which calendar I'd like to add them to.
That happened, well, almost. It did import each event, but asked me for each and every one which calendar to add to. This is fine if you have a handful of events, but mine dated back to 2007! To add salt to the wound my events disappeared moments after adding them - it seems iCloud had some sort of agenda with the imported events and veto'd them one by one until the calendar was empty again. Interestingly, any events I created "by hand", would persist and show up on icloud.com.
Perhaps it was the volume of
.icsfiles which was the issue? Or maybe there was some sort of line on those files causing a parse error somewhere.
My next move was to find a way to merge them all and try importing all at once. I had a quick search but couldn't find any tools for merging
.icsfiles, or which could otherwise assist in importing my
.icsfiles. So I went ahead and built one myself.
Merging multiple .ics files
I write a small command line tool which automates the merging process of
.icsfiles contained within a directory. There was no way I was going to do it by hand, plus, if it helps just one other person out then I'll consider myself a hero and sleep happy.
There's no need to go into detail here about how to use it, but you can find the originally named ICS Merger tool over at GitHub. Install it quickly/easily with brew.
merged.icsin hand I attempted to import into iCal... same problem as before (but, hey, at least I didn't need to confirm which calendar ten million times).
Use the phone, Luke.
merged.icswas ok, as I could import it into one of my Google calendars no problem. The issue was most definitely something at the local end of iCloud (perhaps I buggered the permissions with my restore earlier?). So I sought to find a work around.
The one I found was remarkably simple - use my iDevice. I simply emailed
merged.icsto myself and then opened it in the Mail app on my iPhone. Sure enough, it read it fine and [after a bit of thinking] imported the whole thing into my chosen calendar on iCloud. It synced up, and was soon reflected on my MacBook.
Happy days! For now, anyway.