Restoring Gmail inbox from Time Machine

Time Machine backs up Gmail messages, but not in the right folders. How can I recover the folder structure?


I'm using the most current version of Yosemite.


  • I understand about Gmail tags, and how more than one tag can apply to a single Gmail message.
  • I understand that, because of this, Yosemite mail makes just one copy of the message, but figures out how to display messages properly in their folder(s).


  • I was working on Gmail directly on the web because I wanted to set up some filters. By mistake, I created a filter that moved all e-mail sent to my main address into the archive folder. This was OK because no messages were lost, and I usually sweep all my e-mail there (eventually) anyway.
  • However, I wanted to know which folders were in the inbox before I ran that filter. I had 50 or so e-mails over several months that still needed to be dealt with, and now they were irrecoverably (as far as Gmail was concerned) in my archive.
  • I had a time machine backup from a few hours earlier that was -- theoretically -- perfect for letting me know which e-mails were there before so I could deal with them. But, when I started Time Machine and went back a few hours or days in time the inbox was completely empty. I took the computer off line from internet, restored the whole Gmail account, but there were no e-mails in the inbox.
  • My iCloud and work (Exchange) account were fine; the inboxes there behaved normally.


How are you supposed to restore a Gmail setup to a previous state when this happens? I suppose I could have wiped my computer clean and then asked Time Machine to restore the whole computer to a prior state, but that seems a lot of work for a system that is supposed to allow you to go back in time for just a file or e-mail. Is there any solution using Time Machine?


I tried restoring the mailbox from a Backblaze snapshot from a few hours prior, but it was empty, just like he Time Machine backup.


I was able to recover the prior state because, luckily, I had made a Carbon Copy Cloner backup the night before. When I booted my Mac from the Carbon Copy Cloner bootable backup, it was slow to boot and run, but I was able to see the inbox as it was, export just the inbox, and make a note of which e-mails were there. However, I don't make Carbon Copy Cloner backups all that often (maybe every week or two), since my immediate backups should be in Time Machine and Backblaze.


Does anyone know how to restore a single Gmail folder -- or a whole Gmail account, but with e-mails in the right folders -- using Time Machine?


Thanks in advance for any assistance.

Posted on Jun 5, 2015 3:15 PM

Reply
27 replies

Jun 12, 2015 11:40 AM in response to Linda Custer

Do a backup.

Quit the application.

Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J. When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder. Select Library/Mail. Enter Time Machine and restore what you want.

Jun 12, 2015 3:23 PM in response to Eric Root

Hi, Eric,


Thanks for the info.


I went into the library folder, and then into Mail>V2. There, inside the associated info for the Gmail account, is an INBOX.mbox file, but it only has an info.plist item -- no actual mail. Restoring that leads to not restoring any mail at all.


I went to the Genius bar at an Apple store and walked them through all of this. We went there too. They escalated it to corporate, but I haven't heard anything back.


It seems, as of now, the Gmail messages get backed up, but they are all in the All_Mail.mbox file. The hierarchy doesn't get picked up unless the entire computer (or at least more files than just in the [user]>Library>Mail>V2 folder) gets restored, so there is something else that actually tracks that. Time Machine can't make heads or tails of it.


This is a Time Machine bug as far as I can tell.

Can someone else reproduce this bug and show the same issue with Gmail? Your e-mails aren't lost but they aren't in folders when you use Time Machine unless you wipe your computer and do a full restore?

Thanks.

Jun 12, 2015 4:25 PM in response to Linda Custer

In a new User, restore your Time Machine copy of Mail when the data existed. Using a new User is a safe option since there is no chance you can mess up your current data.

Once you restore the data, you can export the data and import back in your current Mail.

If there is nothing in your current Mail, you could use this to replace your current Mail.


CREATE A NEW USER

Go to System Preferences --> Create a New User in Users & Groups.

Switch to the New User by logging out under the Apple in the Menu Bar.


Use the Shared folder to move the data back to your main User.


Your Hard Drive/Users/Shared

Jun 12, 2015 8:54 PM in response to Linda Custer

From your post, I could not tell exactly how you entered Time Machine. All my accounts are IMAP, including Gmail. Time machine keeps a snapshot of all messages in the Inbox for offline viewing. If they are in the Inbox when TM backs up, then they get copied to the backup. I can go back in time and view and restore messages from the past. I can also view messages by browsing through the TM drive backups manually. Where as you say you only have Info listed in the gmail folder, I have other files storing messages.

I also tested this again with the Gmail Trash and could see messages in the trash in the timeline.

This is a screenshot of my TM backup folder showing my gmail Inbox backup. Backup messages are contained in those 2 folders. You should see something similar when you select a backup of a time when messages existed in the INBOX.

User uploaded file

The fact that you say you can't see them from entering TM while in Mail, and you can't manually navigate in the TM backup drive and see messages in the Gmail Account folder of your user account on the TM backup drive means your TM drive is not backing up gmail. If you have other email accounts, you might check those also and see if TM is backing those up.

If they aren't in your backups, then there is nothing you can do to retrieve the info you want.

Jun 12, 2015 9:21 PM in response to Glenn Leblanc

Very interesting.


Thanks for the attachment.


I have what you have, but only info.plist. None of the folders with things starting with 2DA7. Those folders exist in Gmail.box and in my other (non-Google) accounts, but not in INBOX.mbox or any other folder in that Gmail account.


The non-Gmail accounts are exactly like yours looks, and I can browse back through Time Machine with no problem at all. It's just the Gmail account that is messed up.


Very important note: It is that way on the Carbon Copy Cloner backup too, though. On that USB drive, if I plug it in and boot with it (while staying off the Internet so it doesn't re-sync with Gmail), it looks the same as it does on the Time Machine previous backups: The [user]>library>V2>Gmail account>INBOX.mbox folder only has info.plist and nothing else. However, if I run mail there, mail finds items in the inbox.


Let me repeat that, because it's very weird: mail finds items in the inbox. Even though [user]>library>V2>Gmail account>INBOX.mbox has nothing in it except info.plist.


Second very important note that I didn't mention earlier: this account is a Gmail account, but it is one that I pay about $4 or $5 per month for and it is a Google apps for business e-mail. (I do this because it is the only way to get push Gmail on an iPhone.) It is listed as an IMAP account in mail, though, and functions well.


So. Where does that leave us? I understand you asking whether Time Machine is functioning properly. On my work and iCloud accounts, it definitely is. The INBOX.mbox folders have things in them, and Time Machine can go back in time fine and I can watch e-mails disappear and appear in the inbox as I would expect. My work account is a Microsoft Exchange account, and the iCloud account is iCloud IMAP.


I've also established by carefully looking at the situation that Carbon Copy Cloner captured, when my inbox had the correct (as yet undeleted e-mails) in it, that I was able to turn off Internet, boot from that drive, run mail, and find all the expected e-mails in the inbox, even though the INBOX.mbox folder there too was empty except for info.plist. So it can't just be a problem with Time Machine.


Also, the same situation exists on my Mac right now using its regular internal drive and not the CCC drive. The Gmail account (a while after the event we're talking about) has about 20 inbox items in it. (Confirmed by logging into gmail.com.) They all show up just fine in the Mac mail program -- perfectly echoing what is showing up on Gmail on the web. But if I go to my user library (going into the finder, holding down alt/option while selecting the Go menu, then navigating to mail>V2>[Gmail account]>INBOX.mbox, again it only shows info.plist. No other folders; no other items.


So I don't think it's Time Machine's fault. Time machine is backing up what it sees. Somehow, Mail is storing the information about what is in the inbox in some other place.


Is anyone else seeing this?

Jun 12, 2015 9:27 PM in response to dianeoforegon

It's not the actual e-mails I'm trying to restore -- I never lost those since they were re-filed into the All Mail area.


It's the folder structure as it existed a few hours before, as captured by Time machine.


As you mention, Gmail stores all the e-mails in the main folder. My issues is that I want to re-create the folder structure as it was before I mistakenly moved all the inbox e-mail into the All Mail (archive) area.


I was able to do this by booting from a Carbon Copy Cloner bootable backup that I luckily had made the evening before, but I don't make those every hour or day. I'm wondering how I can get through this if something similar happens in the future and I can only rely on Time Machine.


(Or BackBlaze. BackBlaze also keeps an hourly backup. It gave me the same headache. Since there was nothing in the inbox to restore, I couldn't use it.)


I suspect that if I wiped my Mac clean and then restored everything from Time Machine, I would have gotten the messages back in the inbox. But of course I didn't want to go through that when Time Machine should be able to let me see the structure of the e-mails in folders from a few hours ago very easily, as it does with my non-Gmail accounts.

Jun 12, 2015 9:28 PM in response to dianeoforegon

I see them in mine in the TM backups, and I can view them in the Mail app within TM.

The shot above in the INBOX for Gmail, and below in the rest of the mailboxes for Gmail. Messages are contained, but I couldn't expand the screen far enough to show.

User uploaded file

If TM is backing up the account, then it should show in the folder, or from within TM. You don't need to backup the whole folder. If they don't show in the folder, then there is nothing to restore.

Below is my TM backup from 4 backups back in the timeline where they existed in the Inbox. 2 messages present:

User uploaded file

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Restoring Gmail inbox from Time Machine

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.