brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: shasum -a 256 checks a download on macOS against its published checksum

macOS
~/tips/tip-macos-shasum-256-check

shasum -a 256 ~/Downloads/debian-13.iso

Calculates the SHA-256 of a file on a Mac, or checks it against a list of checksums.

Many projects publish a SHA-256 checksum next to their downloads. Comparing it takes one command on a Mac, no extra app.

shasum -a 256 ~/Downloads/debian-13.iso

-a 256 picks SHA-256. Without it, shasum uses SHA-1, which is not what download pages usually list, so the numbers will not match and you might think the file is broken. Other choices are 224, 384 and 512.

When the project ships a checksum file, let shasum do the comparing:

shasum -a 256 -c SHA256SUMS

-c reads the list and reports OK or FAILED per file. The file needs the usual format: hash, space, file name. Add -s to print nothing and only set the exit code, which suits a script, or -w to warn about lines that are not formatted properly.

I find it worth the ten seconds for ISOs and installers that I download from mirrors.

Caveat: a checksum proves the file matches what the page says, nothing more. If the download page itself was tampered with, the hash on it is too. For real proof of origin you need a signature check, like the GPG signatures many Linux projects publish next to the sums.

Further reading: shasum reference (ss64)

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link