Apps / Pi SD Manager / Guide

Guide — Raspberry Pi

How to back up a Raspberry Pi SD card on a Mac

Every Raspberry Pi lives one corrupted card away from a rebuild. Here is every honest way to image a Pi's SD card from macOS — the free Terminal route, the tools that don't quite do it, and the app we built because none of it was good enough.

01 /Why bother

Your Pi is one bad card away from starting over.

The SD card is the weakest component in any Raspberry Pi. Flash memory survives a finite number of writes, and a Pi writes all the time — system logs, temporary files, whatever your project is doing. Cut the power mid-write, which happens to every Pi that lives behind a switch or a plug timer, and the filesystem can corrupt long before the card physically wears out.

The part that stings is that the card is the machine. The OS, your configuration, your scripts, that Wi-Fi fix you found at midnight two years ago — all of it lives on one small piece of flash. When it dies, you rebuild from memory.

This guide is for anyone with a working Pi they'd rather not rebuild: a home server, a retro-gaming build, a camera, or — as in our case — Pis quietly running inside installations and show kit. The goal is simple: a known-good image on your Mac that you can write to a fresh card in minutes.

02 /The Terminal route

Method 1 — dd and gzip, free and built in.

macOS already ships everything you need to clone an SD card: diskutil to find and unmount it, dd to copy it sector by sector, and gzip to compress the result on the way through. It costs nothing, it's scriptable — and it is completely unforgiving. Here's the whole job:

StepCommandWhat it does
1diskutil listFind the card. Look for an external, physical disk matching the card's size — usually a small FAT32 boot partition plus a Linux partition. Note the identifier; we'll use /dev/disk4 below.
2diskutil unmountDisk /dev/disk4Unmount the card's volumes without ejecting it, so the raw device stays available.
3sudo dd if=/dev/rdisk4 bs=1m | gzip > ~/pi-backup.img.gzRead the entire card and compress it into one file. Note rdisk4, not disk4 — the raw device is dramatically faster.
4Ctrl+Tdd prints nothing while it works. Press Ctrl+T in Terminal to make it report how far it has got.
5gunzip -c ~/pi-backup.img.gz | sudo dd of=/dev/rdisk4 bs=1mRestore: unmount the target card as in step 2, then write the image back.

The caveats are real. First, the disk number. dd does exactly what you tell it, instantly, with no confirmation — point of= at the wrong disk and it will overwrite your backup drive without a murmur, and there is no undo. Run diskutil list with the card out, again with it in, and be certain which number appeared before you type sudo.

It images the whole card, not your data. dd has no idea what a filesystem is, so a 64 GB card means reading 64 GB — the time scales with the card's size, not with how full it is, and the image only compresses as well as the free space allows.

Restores need a card at least as big as the original — and thanks to manufacturing tolerances, "the same size" often isn't (see the FAQ).

And nothing is verified. You find out whether the image was good the day you try to boot from it.

03 /Raspberry Pi Imager

Method 2 — Raspberry Pi Imager: great at writing, no backup.

Raspberry Pi Imager is the official tool, it's free, and at its actual job — writing OS images to cards — it's excellent: pick an OS, pick a card, preconfigure Wi-Fi, SSH and your user before first boot. If you're setting up a fresh card, use it.

What it doesn't have is a backup function. There is no card-to-image option; it only writes. The realistic pairing is dd to create the image and Imager's "Use custom" option to write it back later — which works, but leaves you with all of dd's caveats at the moment that actually matters.

It's worth saying that the Mac answer to this used to be ApplePi-Baker, which did read cards to images — but it hasn't seen updates in years, which is a large part of why this guide exists.

04 /The shrinking problem

Shrinking images: PiShrink is brilliant — on Linux.

The standard fix for card-sized dd images is PiShrink, a shell script that trims an .img down to just above its used space and sets the filesystem to expand again on next boot. On Linux it's the classic companion to dd.

On a Mac it's a genuine pain. PiShrink depends on Linux tooling — parted, e2fsck, resize2fs, loop devices — none of which macOS has, so you need a Linux machine, a VM, or a privileged Docker container to run it. And because it modifies the image in place, you'll want to work on a copy, which means doubling up multi-gigabyte files while you're at it.

The underlying issue is that macOS can't read ext4, the Linux filesystem the Pi actually lives on. Your Mac can see the little boot partition and nothing else — which is why most Mac-native approaches stop at dumb, full-card copies.

05 /Pi SD Manager

Method 3 — Pi SD Manager: built for exactly this.

We run Raspberry Pis inside installations and show kit, and we got tired of every one of the workarounds above. Pi SD Manager is our free, native Mac app that does the whole job properly, with the ext4 tools built in — nothing else to install, no Homebrew, no Terminal.

Compact backups. It images only the space actually in use and shrinks the filesystem as it goes, so a mostly-empty 32 GB card becomes a file of a couple of gigabytes — and because the filesystem is genuinely smaller, that backup restores onto a smaller card, as long as the data fits. Each backup is a single, dated .pisd file.

Verified restores. After writing a card it reads the data straight back off it and checks it landed correctly — so a bad card or a bad write shows up at your desk, not on site when the Pi won't boot. Restore onto a bigger card and the root filesystem auto-expands to fill it on first boot.

Safe by design. The app can't see your Mac's system disk at all, so the dd nightmare — wiping the wrong drive — simply isn't possible. It asks for your password only when it's actually imaging, and ejects the card when it's done. It'll even reset a forgotten Pi login password directly on the card.

It's free, signed and notarised, 1.6 MB, and needs macOS 14 or later. If you use Homebrew: brew install --cask halfgreybear/tap/pi-sd-manager.

06 /Which should you use

Which should you use?

RouteCostBackup sizeRestore to smaller cardVerified restore
dd + gzip
built into macOS
FreeFull card, compressedNoNo
dd + PiShrink
needs a Linux environment
FreeTrimmed to used spaceYes, if the data fitsNo
Raspberry Pi Imager
writing only
FreeNo backup function
Pi SD Manager
native Mac app
FreeUsed space onlyYes, if the data fitsYes, every restore

If you're comfortable in Terminal, only need the odd one-off image and have spare cards the same size or bigger, dd costs nothing — triple-check the disk number and accept the full-size images. If you already keep a Linux box around, dd plus PiShrink is the classic pipeline. For writing downloaded OS images to fresh cards, Raspberry Pi Imager remains exactly the right tool.

If you're on a Mac and you want backups you'll actually take — compact, verified, restorable onto whatever card is in the drawer — that's the gap Pi SD Manager was built to fill.

07 /FAQ

Frequently asked questions

Can I restore a Raspberry Pi image onto a smaller SD card?
Not if it was made with dd. A dd image is exactly the size of the source card, and it will only restore onto a card at least that big. Worse, two cards both sold as 32 GB often differ by a few hundred megabytes, so a dd image of one 32 GB card will regularly refuse to fit another. Pi SD Manager's compact backups shrink the filesystem as they image, so a backup restores onto any card the actual data fits on — including a genuinely smaller one.
Why is my backup image as big as the whole card?
Because dd copies every sector, free space included — a 64 GB card produces a 64 GB image whether it holds 2 GB or 60 GB of data. Compressing with gzip claws some of that back, but the real fix is a tool that understands the filesystem and skips the empty space: PiShrink on Linux, or Pi SD Manager on a Mac, which images only the used space in the first place.
Can I back up the SD card while the Pi is running?
Not with any of the methods in this guide — they all need the card in a reader connected to your Mac. Imaging a filesystem while it is being written to risks an inconsistent copy, so shut the Pi down cleanly with sudo shutdown -h now, wait for it to power off, then pull the card and image it.
How often should I back up a Pi's SD card?
Every time the setup reaches a state you would not enjoy rebuilding: after first configuration, after any significant change, and before risky experiments like a major upgrade. For a Pi in a long-running installation, take an image when it is commissioned and again whenever it changes. The backup you make while everything works is the one that saves you.
Do SD cards really wear out?
Yes. Flash memory survives a finite number of writes, and a Raspberry Pi writes constantly — logs, temporary files, application data — so even a good card is being slowly consumed. Sudden power loss mid-write can also corrupt the filesystem long before the card physically wears out. Treat the card as expendable and a recent image as the real machine.

08 /Get the app

Back your Pi up today, not the day after it dies.

Pi SD Manager is free, and the first backup takes a couple of clicks: open the app, choose your card, go. Everything else — the compacting, the verification, the auto-expand — it handles for you. There's more detail on the Pi SD Manager page.

Free · notarised & signed · checks for updates in-app.

Pis in your show rig? You might also want our guides to test patterns for projectors and LED walls and running a stage timer on a Mac.