1、安装
MacOS 上我们通常会遇到 3 个不同的 openssl,分别是
-
系统自带的使用 LibreSSL 的 openssl
-
homebrew 安装的 openssl
-
miniconda 安装的 openssl
后面两种的安装命令如下:
brew install openssl
brew install miniconda
- 系统自带的是 /usr/bin/openssl
后两者安装完成后分别会在下列路径:
-
/opt/homebrew/bin/openssl
-
/opt/homebrew/Caskroom/miniconda/base/bin/openssl
由于 miniconda 的 bin 路径放在了 PATH 前面,所以会被优先搜索到。怎么解决?
几个方法:
(1)undo init
conda init --reverse fish
conda init --reverse zsh
记得重新 source
(2)重新调整优先级
export PATH="/opt/homebrew/bin:$PATH"
(3)使用 alias
alias openssl='/opt/homebrew/bin/openssl'
(4)conda 注意事项
调整 conda 被索引的优先级之后,我们使用 conda 可能会遇到问题。Best Practice 是:
只在需要使用 conda 的时候启用 conda 开发环境:
conda deactivate # This will remove the Conda environment’s bin directory from your PATH for the current session.
conda config --set auto_activate_base false
使用 conda 命令来执行 conda 所安装的命令
conda run -n your_env your_command
其实,使用哪个 openssl 其实本来问题不大(版本都是最新版)
区别主要在于使用的配置文件是哪个。OPENSSLDIR
- LibreSSL: /private/etc/ssl/openssl.cnf
- openssl: /opt/homebrew/etc/openssl@3/openssl.cnf
- miniconda: /opt/homebrew/Caskroom/miniconda/base/ssl
所以,只要你理解了这个区别,你用哪个都可以。
不过,默认的 openssl.cnf 配置文件都是一样的。 区别只在于 ca 签发证书时,被签发的证书的保管位置。
全文完!
如果你喜欢我的文章,欢迎关注我的微信公众号 deliverit。