Hello All,
Right or wrong, I seem to have finally found a solution that works for me. Here is what I have done to get Apple Mail in Mavericks 10.9.2 to sync properly with Gmail. I have done this succesffully on all three of my machines (iMac, MacBook and MacMini).
Gmail Setting Prerequisties
Settings > Forwarding/IMAP - As you would expect, IMAP needs to be turned in your Gmail settings (if you have found this post, I'm guessing that's not your issue). I have had success with Auto Expunge turned on in my Gmail IMAP settings. I am not liming my folder size.
Settings > Labels
I have read that you must have Show in IMAP checked for All Mail when syncing with Mavericks, while it needed to be unchecked for Mountain Lion. I can't speak to this need, but I can tell you that Show in IMAP for All Mail is checked in my functioning system. In fact, I have everything checked except Chats. I am "showing" Starred, Important, Sent, Drafts. I am "hiding" Chats, All Mail, Spam and Trash.
On your Mavericks Mac:
1. Remove all Gmail accounts from your system using System Prefs > Internet Accounts. This includes all of it, not just mail.
2. Restart just to be safe.
3. In System Prefs > Internet Accounts, add your Google account with all components EXCEPT the mail component; leave Mail unchecked. At this point, your Contacts, Calendars and Messages should begin functioning throughout the OS. I have experienced a probelm with Notes activating on one of the machines.
4. In Apple Mail, select Preferences from Mail Menu. Do not select Accounts directly from Mail menu, because this will take you back to System Prefs.
5. Inside Mail Prefs, select the Accounts tab.
6. Select Plus Sign to add a mail account. Do NOT select the Google preset, as doing so seems to create infinite sync problems. Instead select Add Other Mail account. - I don't understand it, but I suspect this step is the real trick.
7. Enter your full Gmail email address (user@whatever.com) and password, plus your name as you'd like it to appear.
8. Account Information Tab
Enable, Description, Address and Name as previously entered.
Incoming Mail Server: imap.gmail.com
User Name: Full Gamil address (user@whatever.com)
Password: Google Password
9. Outgoing Mail Server (Edit SMTP List)
Server Name: smtp.gmail.com
TLS Certificate: None
(Advanced Tab)
Use Default Ports 25/465/587
Use SSL
Authentication: Password
User Name: Full gmail address (user@whatever.com)
Password: Google Password
10. Mailbox Behaviors Tab
Uncheck Drafts
Uncheck Sent
Check Junk (I left as Never)
Check Move Deleted to Trash
Check Store Deleted on Server (I chose to delete after one month old)
11. Advanced Tab
Leave Checked - Include when automatically checking
Leave Checked - Automatically download all attachments
IMAP Path Prefix: [Blank]
Port: 993 Use SSL
Authentication: Password
Leave Checked Use IDLE command if server supports
12. Close Mail Prefs / Accounts window. Save settings.
With my Gmail account that's been around for many years, it takes a really long time to do the initial sync. At first, it seems like nothing is happening, but I've left it overnight and come back and it's worked itself out. However, with my newer Gmail account, it gets fully initially synced within a minute or two and stays up to date. If you have a large gmail account, I suggest creating a test account just for the purposes of proving the methodology on your system. In Gmail, you should add it to your overall Google account, so you can be sure all the settings are shared between your old account and the new.
To test success on my machine, I exchange a conversation between my new gmail account and iCloud exclusively inside Apple Mail.
I have attempted to include every setting, because I know this combination has worked across multiple machines and I can repeat it. Some settings probably have zero effect, while making a change to something seemingly benign could potentially cause problems. Once you get the system working, you can experiment with the individual settings and post back the more detailed of intricacies of what can be altered.
After completing these steps, you'll see that System Prefs > Internet Accounts at the system level has updated itself to check Mail on your Google account where you had previously left it unchecked in Step 3.
For now, I really hope this can get you back to normal real-time synchronization. Under these settings (after an initial massive sync), my IMAP response time seems perfectly normal, from instaneous to a mintue on the long end.
Good luck; I really hope it works for you and ends some huge headaches. I'm just a user who just wants to use email. It is likely I will not monitor replies to this post, but if I find anything new or different to what I've written here, I'll add it to the thread.
Chris