Hi Schnorkel and others,
I had this problem too. I set up my gmail account on my iphone5 and on my Macbook Pro as IMAP but emails didn't consistently show up in my Macbook Pro Apple Mail, though I could see them on my iphone mail.
I read the above and nothing helped.
Here is what I did that solved the problem:
Delete both IMAP accounts on your iphone and on your laptop.
Make sure you also delete any Gmail POP accounts lingering in either place too.
This is okay because all of your emails are still on Gmail's server.
Then starting on your laptop, add a new Gmail IMAP account.
Make sure it works.
Then add a new Gmail IMAP account on your phone.
This totally solved it for me.
I wondered if I set up the iphone gmail first and that may have been somehow pulling messages and not getting them to my laptop. Maybe a random glitch but I think that setting up the account on your laptop first is key. I am not a tech person but this truly solved my problem. Now I am getting messages in both accounts without a problem.
Good luck. Remember to delete ALL Gmail accounts first!