I can run a command like the following in my script on linux:

openssl dgst -sha256 \
             -mac HMAC \
             -macopt hexkey:xxxx

But this command fails on mac os with the error

unknown option '-mac'

I've tried sifting through man pages and online but I can't find any way to accomplish similar task using mac's version of openssl?


What version of macOS is this? Older releases (10.11) have an old openssl that fails

$ /usr/bin/openssl version
OpenSSL 0.9.8zh 14 Jan 2016
$ /usr/bin/openssl dgst -sha256 -mac HMAC -macopt hexkey:DEADBEEF
unknown option '-mac'

while newer (10.13) instead have LibreSSL that does not error out for your command. On older macs you could perhaps install openssl via a ports system (Fink, Homebrew, MacPorts).

| improve this answer | |
  • Thank you - this was actually the problem. I had installed a newer version on mac os 10.11.6 but it didn't update it – user868543 Feb 2 '18 at 2:43
  • Let me correct my comment, the newer installed version wasn't updated at the default mac installed location. I ended up having to link to the openssl in a different folder (brew installation), unfortunately mac os doesn't allow updating the symlinks and/or renaming the system installed version with a newer one. – user868543 Feb 3 '18 at 0:25

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.