Mavericks Calendar sync with Google seems entirely broken? In a long drawn out story that started with trying to implement CardDAV (I'd like to store my contacts on google if possible), I removed my google account from Internet Accounts, which had existed there from Mountain Lion, and was working perfectly fine for Calendar.app and Messages.app.

Upon trying to re-add the Google account and have it sync my calendars, It's telling me that it cant do it anymore. I'm using two-factor google authentication, and I provide the setup with a generated, app specific password. Contacts and Messages click instantly, but Calendars sits spinning. It eventually informs me that:


  A secure connection couldn't be established
  
  Click "Continue" to continue creating the account. 
  You can edit the account later in Calendar 
  preferences if necessary
  
  Cancel Continue


Console informs me that:

28/10/2013 2:26:38.652 am com.apple.internetaccounts[13796]: [com.apple.calendar.iaplugin.log.CalInternetAccountsPlugin] [Autodiscovery error: [Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x7fbbc50f0550 {NSUnderlyingError=0x7fbbc5629870 "The request timed out.", NSErrorFailingURLStringKey=https://user%40gmail.com@google.com:8443/principals/, NSErrorFailingURLKey=https://user%40gmail.com@google.com:8443/principals/, NSLocalizedDescription=The request timed out.}].]


Continue will just repeat this loop indefinitely.

I've done some digging and found these resources, although evidently they did not work for me:


http://productforums.google.com/d/msg/calendar/7XZkRZzo10I/5oo7RReNhrAJ
https://developers.google.com/google-apps/calendar/caldav/v2/guide#new_endpoint


It seems that the endpoint is no longer valid? Multiple attempts to create a CalDav account in Advanced mode attempting all flavours and variations bore no fruit.

How can I get this working again?
Here's what worked for me:


Open Calendar.app
Open Preferences (⌘+,)
Click Accounts tab
Click plus button (+) to add an account
Select "Add CalDAV Account..."
Click Continue
Select "Account Type" Manual
Username is your full email address "yourname@gmail.com"
Password is your password (or application specific password if you use 2 factor auth)
Server Address is "https://www.google.com"


Notes:


Don't forget the "@gmail.com" on your gmail address! You can also use your own domain name if a Google Apps user
The "https://" on the Server Address field is critical. Without this you will get an error about not being able to establish a secure connection (https uses SSL where http doesn't).