I want to be able to acces the calendars I have on my ICloud account without having to use a web-browser, and possibly offline.
How can I sync my calendars from ICloud with some calendar client on Ubuntu?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityThe answer by the OP is very useful but it's missing some key pieces. In particular how to determine the complete caldav URL by substituting the XXXX
above.
Credit for my answer is due to this blog post (note: I use Thunderbird/Lightning as my caldav client but this is irrelevant) .
The format of an iCloud caldav URL is as follows:
https://pXX-caldav.icloud.com/<DSid>/calendars/<pGUID>
To determine the relevant parameters, first logon to your account on icloud.com
, then launch the Firefox web debugging console (F12). The steps are depicted on the below screenshots which show the web debugging console below the iCloud calendar page. With the "Network" tab selected -step (1)- generate some traffic against desired calendars (eg: create a dummy appointment). Look for the corresponding POST
(or GET
) interactions.
DSid
parameter is some sort of numeric userID so it will be the same for multiple calendars/tasklists owned by the same account. Flip to "Parameters" -steps (2) & (3)- to reveal it.
pGUID
varies from calendar to calendar (it could simply be "Home" or "tasks" if you don't have multiple calendars/tasklists setup). It can be peeked from the same interactions, but using the "Response" tab -steps (4) & (5)- You may have to drill down in the JSON structures a little to discover it.
That's all well and good. However it all stopped working quite recently and the comments at the bottom of the aforementioned blog post thankfully pointed to the source of the issue: since June 2017 Apple is migrating iCloud accounts to enforce app-specific passwords as a very sensible security measure. This means it's no longer possible to just use the main iCloud password for authentication when syncing calendars.
Once migration has happened to your iCloud account (you'll notice your calendar sync fails) the following steps are required:
This news item (in German, use Google translate if necessary) has the background info on app-specific passwords.
BTW: I don't think calendars have to be shared in order to be accessed in this way.
Here's a 2018 Update. If you want to use your iCloud calendar in Gnome Calendar you still need to install Evolution. After you added the calendar, you can remove Evolution.
To sync your ICloud calendars you will need a calendar client that supports CalDAV, e.g. Evolution, which is the one I will show, as it automatically displays the same content on Ubuntu's default calendar.
1. Download Evolution mail/calendar client:
Install it from Software Center:
or run sudo apt install evolution
.
2. Open icloud.com in a web browser and go to your calendars. Click on the circular wireless icon to the right of the name of the calendar you want to use.
The calendar you want to use must be shared (dark icon). If it's not, you'll be presented with the option there.
3. Once the calendar is shared, note the name of the server right after webcal://
(example: p02-www.icloud.com
)
4. Open Evolution:
Configure it as:
Type: CalDAV
Enable Copy calendar contents locally...
to acces it offline.
URL: If the server was p02-www.icloud.com/abc/123
, you would replace www
with caldav
and enter p02-caldav.icloud.com/abc/123
. And it should always look like http://pXX...
, not like http://webcal://pXX...
User: [email protected]
5. Click on Find Calendars, enter your ICloud password and select whichever calendar you want to sync.
6. If you want to sync more than one calendar, just repeat from step 3 in advance.
Now your ICloud calendars will appear on Calendar and you will get a preview on the top panel calendar indicator
Mandatory for it to work You should also go to the address below, then to the Security tab, passwords for applications. Type Evolution in the field, then copy the generated code and paste it into evolution in the requested password.