Update (October 2026): foremost is now available on Homebrew, with builds for both Apple Silicon and Intel Macs. That is the quickest way to install it; the original build-from-source steps are still below.
Foremost is a console program that recovers files from a raw disk image (like those created with dd or dc3dd) or directly from a drive, based on their headers, footers and internal data structures. It supports many file types out of the box (JPG, GIF, PNG, DOC, XLS…) and you can add more in its configuration file.
Option 1: Homebrew
brew install foremost
Option 2: build from source
Download the source code from the official site:
curl -O https://foremost.sourceforge.net/pkg/foremost-1.5.7.tar.gz
Extract the archive and move into the new folder:
tar zxvf foremost-1.5.7.tar.gz
cd foremost-1.5.7
Compile and install:
make mac
sudo make macinstall
The binary is installed in /usr/local/bin/ and the configuration file in /usr/local/etc/foremost.conf. You need the Xcode Command Line Tools to compile (xcode-select --install). I originally tested these steps on macOS High Sierra (10.13.5); on recent versions of macOS, Homebrew is the easier route.
Quick test
foremost -t jpg,pdf -i image.dd -o output
This carves JPG and PDF files from image.dd into the output folder, together with an audit.txt report of what was found.
Leave a Reply