Missing unread mail count in the dock on Mac OS X 10.9 (Mavericks)

I’ve had plenty of issues with mail in Mac OS X but most of them have been related to the poor implementation of the integration with Exchange. But I have finally found a solution for one specific problem. That is the missing unread count in the dock. This is how I fixed it. Quit mail entirely and run from a command prompt # mv ~/Library/Mail/V2/MailData/Envelope* ~/Desktop/ Not open mail once again and it will do a import of all mails (Took about 2 hours on my machine but it depends on how many mails and mail accounts you have).