How to upgrade the openssl that comes with Mac? (Process summary)

不言
Release: 2018-09-07 14:41:39
Original
3267 people have browsed it

How to upgrade the openssl that comes with Mac? The following article will introduce to you the upgrade process of openssl that comes with Mac. You can refer to it if necessary.

Since the openssl that comes with Mac is too old, here you need to upgrade to a higher version to install the python expansion package, so let’s summarize the upgrade process.

1. Install openssl

First, let’s take a look at our openssl version and directory:

->  ~ openssl version
OpenSSL 0.9.8zh 14 Jan 2016

->  ~ which openssl
/usr/bin/openssl
->  ~
Copy after login

Through the above review, it is obvious that our version number is too low.

Follow the above steps, we first update homebrew

brew update
Copy after login

Installation:

brew install openssl

# 重新安装
# brew reinstall openssl
Copy after login

After successful installation:

~ brew reinstall openssl
==> Reinstalling openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2p.el_capitan.bottle.tar.gz
Already 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
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl you may 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
Copy after login

Instruct us Successfully installed openssl to /usr/local/Cellar/openssl/1.0.2p.

2. Replace the old one

However, we still have the last step, that is, when we use openssl, we use the newly downloaded openssl with homebrew. To achieve this goal, we have two methods.

Put the opensslsoft link downloaded by homebrew to the /usr/bin/openssl directory. Here, we first save an old copy of it, and then soft link the newly downloaded one.

$ mv /usr/bin/openssl /usr/bin/openssl_old
mv: rename /usr/bin/openssl to /usr/bin/openssl_old: Operation not permitted
$ ln -s /usr/local/Cellar/openssl/1.0.2p/bin/openssl /usr/bin/openssl
ln: /usr/bin/openssl: Operation not permitted
Copy after login

Operation not permitted prompts that there is no permission to operate. I have encountered this problem several times for things in the /usr/bin directory, so I continued to google and found Operation Not on stackoverflow. Permitted when on root El capitan (rootless disabled).

Restart the system. When starting, we press cmd r at the same time to enter Recovery mode, then select Utility => Terminal, enter the following command in the terminal, lock the interface file system, and restart the computer (cmd r After that, you will enter another interface for selecting system startup. Do not restart immediately in this interface. First find the terminal and enter csrutil disable) in the terminal:

$ csrutil disable
$ reboot
Copy after login

Finally, we execute the previous two commands to view 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 version
OpenSSL 1.0.2p  14 Aug 2018

➜  ~ which openssl
/usr/local/opt/openssl/bin/openssl
Copy after login

How to upgrade the openssl that comes with Mac? (Process summary)

In this way, our openssl upgrade was successful. However, just to be on the safe side, I restarted my computer and re-enabled csrutil.

csrutil enable
reboot
Copy after login

Related recommendations:

macos - How to perform a major version upgrade of PHP that comes with Mac?

The above is the detailed content of How to upgrade the openssl that comes with Mac? (Process summary). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!