Holiday time, photo time – how to recover your lost files with PhotoRec

Few things are more frustrating than losing your holiday photos. Maybe you formatted the wrong card, deleted a folder by accident, or your USB stick suddenly stopped working. The good news: your memories are often still there – you just need the right tool to bring them back.

That’s where PhotoRec comes in. It’s not the prettiest piece of software, but it’s extremely powerful. In this guide I’ll show you step by step how to use it safely, so you can recover your files without accidentally overwriting them.

1. Installing PhotoRec

macOS (Intel & Apple Silicon M1/M2/M3):

  1. Download the “TestDisk & PhotoRec” package from cgsecurity.org.
  2. Extract the archive.
  3. In the Terminal, go into the extracted folder, e.g.: cd ~/Downloads/testdisk-7.2-WIP
  4. Start PhotoRec from inside the folder: sudo ./photorec # text mode ./qphotorec # GUI version (try without sudo first)
  5. Optional: “install” it so you can run sudo photorec from anywhere: sudo cp ./photorec /usr/local/bin/ sudo cp ./testdisk /usr/local/bin/

Windows:

  • Download the ZIP, extract it, and double-click qphotorec_win.exe.
    That’s the GUI version – much easier than the terminal.

Linux (Debian/Ubuntu):

sudo apt install testdisk
sudo photorec

2. How PhotoRec works

  • PhotoRec is read-only: it never writes to the source drive.
  • All recovered files are saved somewhere else.
  • Important: never save to the same drive you are recovering from, or you’ll overwrite the very data you want to rescue.

3. Step-by-step recovery (terminal version)

  1. Start PhotoRec sudo ./photorec (If installed via package manager: sudo photorec.)
  2. Select the drive
    Use the arrow keys to highlight the correct disk → press Enter.
    (screenshot: drive selection screen)
  3. Partition or whole disk
    • Partition → good for accidentally deleted files.
    • Whole disk → if the partition table is damaged.
      (screenshot: partition selection)
  4. Choose file system
    • Windows/macOS → Other
    • Linux ext2/3/4 → ext2/ext3
  5. Search options
    • Free → scan only free space (faster).
    • Whole → scan the entire partition (safer).
  6. Select destination
    Choose another drive (e.g. external USB disk). Confirm with C.
    (screenshot: folder selection)
  7. Let the scan run
    PhotoRec will list found files as it goes. You can stop and resume sessions later.
    (screenshot: recovery in progress)

4. What you get

  • PhotoRec creates folders like recup_dir.1, recup_dir.2, …
  • Files usually don’t have their original names, but extensions are correct.
  • Photos, videos, PDFs, etc. open immediately.

5. Pro tips

  • Work on an image: if the drive is failing, first create an image with ddrescue and run PhotoRec on that.
  • Limit file types: under “File Opt” you can select only JPG, MP4, etc. This saves time and space.
  • Use the GUI: on Windows (and macOS with qphotorec), the graphical interface is far easier.

6. Troubleshooting

  • zsh: command not found: photorec (macOS)
    → Run it as sudo ./photorec from inside the extracted folder.
    → Or copy it to /usr/local/bin/ to use sudo photorec anywhere.
  • “App can’t be opened because it is from an unidentified developer” (macOS Gatekeeper)
    → Allow it once via System Settings → Privacy & Security → Open anyway.
    Or in Terminal: xattr -d com.apple.quarantine photorec qphotorec chmod +x photorec qphotorec
  • No drives visible (macOS)
    → Give Terminal “Full Disk Access” under Privacy & Security and restart it.
  • Apple Silicon (M1/M2/M3)
    → Install Rosetta if needed: softwareupdate --install-rosetta

Conclusion

PhotoRec may look old-school, but it’s a lifesaver when your data disappears. With the right steps – and a bit of patience – you can bring back photos, videos, and documents you thought were gone for good.