Skip to content

Instantly share code, notes, and snippets.

@KEINOS
Created May 17, 2023 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KEINOS/88464a74a60c7898d6c4dd06c8194db8 to your computer and use it in GitHub Desktop.
Save KEINOS/88464a74a60c7898d6c4dd06c8194db8 to your computer and use it in GitHub Desktop.
How to verify the SHA2-256 checksum file in macOS.

How to verify the checksum file?

TL; DR

Use -c or --check option of shasum or sha256sum command.

$ # The target ISO image and its hash file
$ ls 
alpine-extended-3.18.0-x86_64.iso		alpine-extended-3.18.0-x86_64.iso.sha256

$ # Verify
$ shasum -c alpine-extended-3.18.0-x86_64.iso.sha256
alpine-extended-3.18.0-x86_64.iso: OK

$ sha256sum -c alpine-extended-3.18.0-x86_64.iso.sha256
alpine-extended-3.18.0-x86_64.iso: OK
$ # Content of the hash file
$ cat *.sha256
00184d48ef3328cf9f3423324875787df63ac5ad9b0dae41cebb29281f8e5d9c  alpine-extended-3.18.0-x86_64.iso

$ # Re-calculate the hash
$ shasum -a 256 alpine-extended-3.18.0-x86_64.iso
00184d48ef3328cf9f3423324875787df63ac5ad9b0dae41cebb29281f8e5d9c  alpine-extended-3.18.0-x86_64.iso
  • Env info
$ shasum --version
6.02

$ sw_vers
ProductName:	macOS
ProductVersion:	12.6.5
BuildVersion:	21G531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment