Mac平台软件包管理器Homebrew使用curl下载文件,有些是使用https连接下载的。但由于网络环境或一些其它原因,造成https证书认证失败而无法下载。
curl 的”-k”选项可以解决这个问题,不检查ssl证书安全性而直接下载,这可能带来一些安全风险。
但你若对homebrew足够信任,那可以修改其源码给curl加上“-k”选项,方法如下:
1 |
sudo vim /usr/local/Library/Homebrew/utils.rb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
def curl(*args) brewed_curl = HOMEBREW_PREFIX/"opt/curl/bin/curl" curl = if MacOS.version <= "10.6" && brewed_curl.exist? brewed_curl else Pathname.new "/usr/bin/curl" end raise "#{curl} is not executable" unless curl.exist? && curl.executable? flags = HOMEBREW_CURL_ARGS flags = flags.delete("#") if ARGV.verbose? args = [flags, HOMEBREW_USER_AGENT, *args] args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] args << "--silent" unless $stdout.tty? safe_system curl, *args end |
1 2 |
#这行代码添加 -k 参数 args = [flags, HOMEBREW_USER_AGENT, '-k', *args] |
1 Comment
Leone Rolison · 06/24/2020 at 4:15 AM
Howdy! Do you know if they make any plugins to assist with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Thank you!