Why I don't use Time Machine anymore and how Dotfiles helped me to level up my backup strategy
#dotfilesLast month I have been through hell while my laptop broke one week before my book release. I had a full backup, but it turned out restoring it is not always as easy as you might think. In this article, I tell you my backup story, why I abandoned Apple Time Machine and how Dotfiles help me now.
I Am a Developer, of Course, I Do Backups
I hope everyone knows how important backups are. This is true for your projects but also for your laptop of course. Especially we as developers know that and take that very seriously.
For six years I am using the Time Machine app by Apple to back up my data. Over my router, my laptop is connected to the backup drive, and a backup is taken automatically every day. This is handy, because I don't have to think about it anymore. Additionally, I got some data stored in Dropbox. Backups ✅
Luckily I never had to restore my backups, because I never had a problem with my MacBook Pros(MBP). Until now...
Here Is What Happened
One week before my Build Chatbots with PHP release my MBP suddenly broke. While I was working the display went black, and I suddenly smelled smoke. I immediately knew that wasn't a good sign. This sucked, but of course, this can happen. So what were my options:
- Repair the MBP
- Buy a new MBP
- Borrow an MBP
Repair the MBP
I went to an Apple seller to check my MBP. Unfortunately, this process alone takes about a week, and so I had to left it there. But I still had lots of work on my todo list, and I couldn't just wait for a week; especially not the days before my release.
Buy a new MBP
While I was waiting for my laptop, I thought about buying a new one. I have my own business now and having a computer is crucial to my projects. Still, I wasn't sure if it is a good idea to buy a new laptop before knowing what is up with my current one. Also, it was right before the upcoming update of the MacBook Pro series. So this was no option.
Borrow an MBP
I thought the best solution would be to borrow an MBP. Luckily my mum had an entirely new MBP, and she agreed to lend it to me. So I only needed to restore the backup
.
Restore a Time Machine backup
In theory, it is simple. Boot an MBP in recovery mode and select restore from Time Machine backup. That's also what I did. What I wasn't aware of, is that it takes a looooooooooong time to restore a 450GB backup. I mean like 8-10 hours in my case. This was because my MBP was connected to the drive through the WLAN. Still, this long time would have been fine with me if it worked. But it never finished!
My Mum's MBP only got 250GB of space, but I needed 450GB. I wished Time Machine told me about that before I had to wait for hours. As a result, I needed to get a 500GB MBP. Luckily an old friend of mine was kind enough to borrow me one of his MBPs from his company. He was a life-saver! Nobody likes to give away an MBP, so I appreciate that.
Ok, so back to the restoring process. I tried it four times (= 3,5 days), but I always got an error close to the end that didn't help me at all to know what was wrong. I was angry spending so much time without any success!
After lots of angry tweets, someone told me that there are two ways to restore from a Time Machine backup. The first one is from the recovery mode (what I tried) and the second way is with the migration assistant after installing a fresh OSX. So I tried the second one, and on day four it suddenly worked! Don't ask me why! I just felt unbelievably happy and released! But it was clear to me, I would never user Time Machine again
!
Time Machine alternatives
During my backup disaster, I had some conversations about backups on Twitter. Dries was the first one mentioning he is using Dotfiles and iCloud for his backups. I don't use iCloud, but Dropbox is basically the same. And you probably know that I use Dotfiles for many years now. So what was different with his approach?
While I was in Belgium for two meetups, I had the chance to talk to him about it in person. I used Time Machine because I don't wanted to install all my apps and settings again. This would talk too much time. (now I know that a TM backup takes much longer 😀) That was when he told me about Homebrew-Cask
. It is a Brew extension that lets you install MacOS apps with Brew through the command-line. And as if this was not cool enough, he also told me about mackup
. It is a command-line tool that lets you backup and restore MacOS applications settings.
It first sounded a little bit strange, but this was awesome! These two additions bring your Dotfiles to a new level. Instead of just setting up your development environment, you can now set up you whole MBP with all the apps and settings of your choice! Dries has a great article about it in detail on Medium.
My New Backup Strategy
First, like mentioned I don't use Time Machine anymore. But it wasn't just about the app. Restoring 450GB at once is in general not a good idea. So instead of backing up all my apps, I am now storing just the list of apps I need. When you think about it, it is like with Composer. You also don't back up all your vendor files. At least I hope so :-)
So here is how I backup now:
- Documents, designs, images, videos, etc. (Dropbox)
- App settings (Dropbox through Mackup)
- Apps (Dotfiles through Homebrew-Cask)
- Development environment (Dotfiles)
- MacOS settings (Dotfiles)
- Repositories (GitHub and Bitbucket)
- SSH Keys (1Password)
- App licenses (1Password)
Next to the new Dotfiles features, I am also storing more in the cloud. This makes everything now much better accessible than with Time Machine, where you needed the app.
Where to Start
I forked Dries Dotfiles and went through every file to fully understand what is happening. I liked the clear and simple structure, and so I kept that. I only changed some settings to my needs:
- I adapted the MacOS settings in
.macos
. - I am using the
Agnoster
Oh My Zsh theme which is now included in my Dotfiles. - I am using my own aliases file.
- I am using a private aliases file which is now excluded from the repo.
- In the
Brewfile
I added all the tools and apps I use. - I changed the
.zshrc
settings to my needs.
And that's it. It took me about two days to configure everything, but now I have Dotfiles on Steroids
. If anything happens with my laptop again, I am prepared! Here you can check out the repo for my Dotfiles.
Lessons Learned
- Having a backup is not enough. Try out restoring it!
- The cloud is your friend if you trust it!
- Automate as much as possible.
- Be prepared for the worst. As a developer, we need to get back to work as soon as possible.
- Work on your Dotfiles. Every time I find something that I need to change on my Mac, I I add it to my Dotfiles.
I hope I could help others out there with this article and to make you think about your backup strategy again. You never know when your laptop is starting to smoke :-)