macで openssl コマンド使うとエラーになった。
% openssl x509 -in test.crt -text -noout
unable to load certificate
...
一応バージョンは
macOS Catalina 10.15.7
他のバージョンで発生するかは不明。
brewで入れてみる。
% brew install openssl
Updating Homebrew...
・
・
・
Error: Failed to link all completions, docs and manpages:
Permission denied @ dir_s_mkdir - /usr/local/share/fish
Error: The following directories are not writable by your user:
/usr/local/lib/pkgconfig
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/lib/pkgconfig /usr/local/share /usr/local/share/man /usr/local/share/man/man1
And make sure that your user has write permission.
chmod u+w /usr/local/lib/pkgconfig /usr/local/share /usr/local/share/man /usr/local/share/man/man1
なんかエラーが出たので言われたとおり実行。
% sudo chown -R $(whoami) /usr/local/lib/pkgconfig /usr/local/share /usr/local/share/man /usr/local/share/man/man1
Password:
% chmod u+w /usr/local/lib/pkgconfig /usr/local/share /usr/local/share/man /usr/local/share/man/man1
で、brew で openssl が入った。
が解消しない。
% which openssl
/usr/bin/openssl
これは brew で入ったものではない。
% brew link openssl
Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
言われた通り、
% echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
でターミナル新しく起動するとコマンドが通った。