I've been using POP to access my Gmail account pretty much since Google offered it. I've been meaning to migrate to IMAP access for a while now, and initial attempts to switch yesterday caused quite a bit of pain. I had problems ranging from 55000 messages trying to download, to being locked out of my account with the error message 'Account exceeded command or bandwidth limits.'

I've found a useful looking reference, http://tidbits.com/article/10253, but it was written back in 2009, so I'm not sure how much of the information has been superseded in subsequent Mail upgrades. Does anyone else have experience and/or links to resources about using Gmail IMAP and Mail in Lion effectively?

2 Answers 2


Firstly, if you're using Gmails two-factor authentication, you'll need to setup a one-time password for Mail.app to use. From the look of it, you are not using this feature but you probably should and so should everybody else so I'll include the steps for completeness. You can create a new one-time password by going to your Google Account settings (not Gmail settings). You'll see a section like the one in the image below.
Google Account Settings
Click on the 'Edit' beside 'Authorising applications & sites' and enter your google account password when prompted. You'll be brought to a page where near the bottom you can name the app you're creating a one-time password for and then click create password. See image below. Create password dialog Your password will be generated, spaces in it don't matter so you can just select it and copy to the clipboard. Then open the Mail.app and if you don't get the dialog for adding an account, you can bring it up by clicking Mail > Preferences and you can click the '+' symbol at the bottom-left to add a new account. Put your gmail address, including 'gmail.com' in the 'Email Address' field and you newly generated one-time password in the 'Password' field and hit Enter. Mail will connect to the server and validate then setup your account.
Click 'Create' when prompted and you're ready to go.

Now, to manage the mail that your Mac will download and store locally you go to the Advanced tab for the account. There is a dropdown (pictured below) which allows you to select what Mail will download.
Mail preference pane
If you don't want to download all mail and attachments, change the default to one of the other options shown below.
mail options

  • If you select 'All messages and their attachments' this will download every email you've ever sent/received which still exists in your online gmail account. This is the default and probably the reason you exceeded your limit. This should be a one-off problem though if you downloaded them all and this is what you want.
  • If you select 'All messages but omit attachments', it will still download every mail you've ever sent as above, just without the additional bulk of attachments.
  • If you select 'Only messages I've read' then Mail won't download unread messages, leaving you to read your unread mail on gmail in your web browser.
  • If you select 'Don't keep copies of any messages' then you will only ever see mail in your Mail app when you are online. Essentially this will function as if you're using your web-based email account on gmail.com but through the Mail app. This means you don't use lots of storage on your Mac, but it also means you need to have an internet connection to use your account.

I hope that clarifies your choices and helps you choose the best option which suits your needs. Also, if you're going to use IMAP, which you probably should, you should stop using POP.

In GMail settings, you can also limit the number of mails which can be held in an IMAP folder to various limits between 1000 and 10000

  • Thanks for the advice (especially WRT two-factor auth). With the exception of that, my configuration is pretty much how you describe it above. However, I've just disabled POP access again, and now IMAP is downloading 1589 messages! I have not received that many valid emails since I had been temporarily locked out of the IMAP interface, so I'm scratching my head as to why this is happening. At this stage I'm thinking it may be attempting to download copies of messages that Gmails spam filter has trapped. If so, is there a way to prevent this from happening?
    – Cleggy
    Jul 26, 2011 at 0:08
  • 1
    @Cleggy - mail downloaded via POP/IMAP are treated separately. Your entire set of mail (plus whatever's in All Mail) needs to be re-downloaded using the new protocol. Or so is my understanding. The limit exceeded message is Google locking you out of your account for exceeding a bandwidth limitation. Set it up, make sure you're not downloading attachments, and let it sync up. Be patient. Once it finishes, remove your old (POP) account. At this point consider downloading attachments. That's it!
    – Harv
    Jul 26, 2011 at 0:17
  • I've just unchecked the 'Show in IMAP' option for the Spam label, so hopefully this will resolve the problem.
    – Cleggy
    Jul 26, 2011 at 0:22
  • I've laid out your choices for syncing mail in the answer above. If you don't want the Mail.app downloading all your email to your computer then you need to pick one of the non-default choices. Once it's downloaded, it won't do it again unless you remove the account. Also, you need to choose IMAP or POP, not both. Jul 26, 2011 at 0:22
  • 2
    @Griffo - the behaviour of Google's "All Mail" folder goes way beyond the scope of what you're trying to do. It can be a serious pain in the rear and Mail.app really isn't smart enough to know about what it should/shouldn't do with mail in there. As far as Mail.app is concerned, it's just another folder. I would uncheck the "Show in IMAP" for this folder as well, in order to avoid using it at all as it totally messes up Google's internal structure.. or can.
    – Harv
    Jul 26, 2011 at 0:52

Furthermore, after Griffo's excellent advice above, you should consult this Google Help document on how to configure Apple Mail to work optimally with GMail over IMAP.


Apple Mail

From the Mail menu, click Preferences > Accounts > Mailbox Behaviors

Drafts: Store draft messages on the server > do NOT check

Sent: Store sent messages on the server > do NOT check

Junk: Store junk messages on the server > checked Delete junk messages when > Never

Trash: Move deleted messages to the Trash mailbox > do NOT check Store deleted messages on the server > do NOT check

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .