I use OS X and have several checksum files that are generated from different external harddisks.

If the checksum files are in the same location as the files to check then I can simply run eg.:

shasum -c sums.sha1

But in my case sums.sha1 is located in ~/Desktop/sums.sha1 and the files to verify are in /Volumes/fr-ubb-1 (external drive, read only).

I understand that it's not possible to pass a location parameter to shasum. What's the best practice to run the verification of my checksum file with files in a different location?


Run it from the directory containing the files to check, and give it the full path to the checksum file:

cd /Volumes/fr-ubb-1
shasum -c ~/Desktop/sums.sha1

This works with most (perhaps all) checksum verification tools, not just shasum.

  • It does not, unfortunately, work with md5 on macOS as it has no verification capability (that I can see).
    – Kusalananda
    Oct 4 '17 at 10:23
  • @Kusalananda isn’t there an md5sum on macOS? At least some macOS users have it but I don’t know whether it came with the OS or was installed separately. Oct 4 '17 at 11:22
  • That's from GNU coreutils, which obviously can be installed on macOS, but isn't by default. md5 is the BSD variation on the same theme. md5 supports -c on other BSD systems (NetBSD and OpenBSD, but it means something else on FreeBSD). My guess is that macOS is using an older version of it.
    – Kusalananda
    Oct 4 '17 at 11:22
  • @Kusalananda OK, thanks for the clarification. I’m not familiar with modern BSD, but yes, macOS does tend to have old versions of the BSD tools... Oct 4 '17 at 11:26

Or modify the content of the sums.md5 to include absolute path to files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.