Time Machine is the built-in service in Mac OS X that makes backups super-easy, and Apple's Time Capsule makes the whole process even easier. Unfortunately, Apple's official hard drive solution is a bit pricey at $349. Raymii shows how to build one with a Raspberry Pi.
Essentially, you're turning the Raspberry Pi into a low-powered NAS, but this one's fully compatible with Apple's Time Machine software. This means you can encrypt your backups and run backups on a schedule. All you really need to do is run a few commands, install some software, and set up your external hard drive. From there, you can use Apple's software to backup your Mac just as you would with Apple's solution. Head over to Raymii for the full guide.