How do I upgrade the OpenSSL that comes with my Mac? The following article will introduce you to the Mac's own OpenSSL upgrade process, there is a need to refer to.
Because the Mac comes in openssl
too old, because the installation of the Python expansion pack needs to be upgraded to a higher version, the upgrade process is summarized.
I. Installation of OpenSSL
First, take a look at our version and directory of OpenSSL:
-- OpenSSL versionopenssl 0.9.8zh 2016-> ~ which openssl/usr/bin/openssl-> ~
Through the above view, obviously our version number is too low.
Following the steps above, we first updatehomebrew
Brew Update
Installation:
Brew Install openssl# Reinstall # Brew Reinstall OpenSSL
After successful installation:
~ Brew Reinstall openssl==> reinstalling openssl==> downloading https://homebrew.bintray.com/bottles/ Openssl-1.0.2p.el_capitan.bottle.tar.gzalready downloaded:/users/kaiyiwang/library/caches/homebrew/downloads/ 96bc2acd84d0fe609dcbe4c6436c864808f7e8f26f2f12111f552f5972c3840a--openssl-1.0.2p.el_capitan.bottle.tar.gz== > Pouring openssl-1.0.2p.el_capitan.bottle.tar.gz==> caveatsa CA file have been bootstrapped using certificates from The Systemrootskeychain. To add additional certificates (e.g. the certificates added inthe System keychain), place. Pem Files In/usr/local/etc/op Enssl/certsand Run/usr/local/opt/openssl/bin/c_rehashopenssl is keg-only, which means it wasn't symlinked Into/usr/loc Al,because Apple have deprecated use of the OpenSSL in favor of its own TLS and crypto libraries. If you need to has OpenSSL first in your PATH run:echo ' export path= '/usr/local/opt/openssl/bin: $PATH ' ' >> ~/.zsh Rcfor compilers to find OpenSSL the need to Set:export ldflags= "-L/usr/local/opt/openssl/lib "Export cppflags="-i/usr/local/opt/openssl/include "==> summary/usr/local/cellar/ openssl/1.0.2p:1,793 files, 12.2MB
We succeeded in installing OpenSSL into the /usr/local/Cellar/openssl/1.0.2p
.
Second, replace the old
However, we have a final step, that is, when we use OpenSSL, we use the homebrew new download of OpenSSL. In order to achieve this, we have two ways.
Homebrew Download the OpenSSL 软链接
to the /usr/bin/openssl
directory. Here, we first save it a copy of the old, and then soft link new download.
$ mv/usr/bin/openssl/usr/bin/openssl_oldmv:rename/usr/bin/openssl to/usr/bin/openssl_old:operation not permitted$ l N-S/usr/local/cellar/openssl/1.0.2p/bin/openssl/usr/bin/opensslln:/usr/bin/openssl:operation not permitted
Operation not permitted prompt do not have permission to operate, to/usr/bin directory of things, I have met several times this problem, so continue Google, found on the StackOverflow Operation Not Permitted when on root El capitan (rootless disabled)
.
Restart the system, when the start of the time we press cmd+r into the recovery mode, and then select the utility of the terminal, the terminal to enter the following command, interface file system lock, and restart the computer (Cmd+r, will go to another selection of system-initiated interface, In this interface do not restart immediately, first find the terminal, in the end of the input csrutil disable):
$ csrutil disable$ reboot
Finally, we perform the previous two commands to view the version.
$ sudo mv/usr/bin/openssl/usr/bin/openssl_old$ sudo ln-s/usr/local/cellar/openssl/1.0.2p/bin/openssl/usr/bin/ openssl$ OpenSSL versionopenssl 1.0.2p 2018➜ ~ which Openssl/usr/local/opt/openssl/bin/openssl
In this way, our OpenSSL upgrade was successful. However, to be safe, I restarted the computer and then turned on the Csrutil again.
Csrutil Enablereboot