rubyhomebrewasdfasdf-vm

Can't compile anything with asdf due to error in Digest::SHA module


Tried to install ruby 3.0.3 on my MacOS but got this error at start:

bash$ asdf install ruby 3.0.3
"$errmsg" is not exported by the Digest::SHA module
Can't continue after import errors at /usr/local/bin/shasum line 24.
BEGIN failed--compilation aborted at /usr/local/bin/shasum line 24.

Compilation kept on going, but failed at a later state.


Solution

  • Tried to figure out what was wrong and checked /usr/local/bin/shasum command:

    bash$ echo "test" | shasum --algorithm 256
    "$errmsg" is not exported by the Digest::SHA module
    Can't continue after import errors at /usr/local/bin/shasum line 24.
    BEGIN failed--compilation aborted at /usr/local/bin/shasum line 24.
    

    Something was wrong with shasum. Figured out how it was installed:

    bash$ ls -l /usr/local/bin/shasum
    lrwxr-xr-x  1 user  admin  32 Dec  1 09:28 /usr/local/bin/shasum -> ../Cellar/perl/5.34.0/bin/shasum
    

    This told me, that perl was installed through homebrew and something was wrong. So I tried to reinstall perl and it fixed the problem:

    bash$ brew reinstall perl
    ==> Downloading https://ghcr.io/v2/homebrew/core/perl/manifests/5.34.0
    ...
    

    Now it was fine:

    echo "test" | shasum --algorithm 256
    f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2  -