Homebrew-cask: brew cask search fails with "certificate verify failed"

Created on 26 Apr 2018  ·  8Comments  ·  Source: Homebrew/homebrew-cask

Description of issue

Homebrew works just fine and all other networking stuff works fine, but brew cask search fails with a certificate error.

Important note: we have a MITM proxy that injects its own SSL certificates. Everything else seems to work with these custom certificates, but not brew cask search. Relevant environment variables:

export no_proxy="localhost,127.0.0.1,*.local"
export HTTP_PROXY="http://proxy.example.com:80"
export HTTPS_PROXY="http://proxy.example.com:80"
export http_proxy="http://proxy.example.com:80"
export https_proxy="http://proxy.example.com:80"

export SSL_CERT_FILE="/Users/timster/cacert.pem"
export CURL_CA_BUNDLE="/Users/timster/cacert.pem"

Do I need to set some additional configurations somewhere?

Output of working homebrew commands

$ brew update
Already up-to-date.

$ brew upgrade
==> Upgrading 1 outdated package, with result:
node 9.11.1 -> 10.0.0
==> Upgrading node 
==> Downloading https://homebrew.bintray.com/bottles/node-10.0.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring node-10.0.0.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/node/10.0.0: 5,301 files, 51.5MB

Command that failed

$ brew cask search java
Error: SSL_connect returned=1 errno=0 state=error: certificate verify failed
Follow the instructions here:
  https://github.com/caskroom/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:933:in `connect'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:852:in `start'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:319:in `open_http'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:737:in `buffer_open'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:212:in `block in open_loop'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:210:in `catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:210:in `open_loop'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:151:in `open_uri'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:717:in `open'
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/gpg-suite-nightly.rb:7:in `block (2 levels) in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/url.rb:10:in `block in from'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl/stanza_proxy.rb:8:in `block in once'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl/stanza_proxy.rb:21:in `to_s'
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/gpg-suite-nightly.rb:12:in `block in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:32:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:32:in `initialize'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:31:in `new'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:31:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:67:in `cask'
/usr/local/Homebrew/Library/Homebrew/compat/hbc/cask_loader.rb:10:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:113:in `cask'
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/gpg-suite-nightly.rb:1:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:16:in `block in each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:15:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:15:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/search.rb:46:in `map'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/search.rb:46:in `search'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/search.rb:8:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:98:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:101:in `<main>'

Output of command with --force --verbose --debug

$ brew cask search java --verbose --debug
==> Determining which containers to use based on 'container :type'
Error: SSL_connect returned=1 errno=0 state=error: certificate verify failed
Follow the instructions here:
  https://github.com/caskroom/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:933:in `connect'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/net/http.rb:852:in `start'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:319:in `open_http'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:737:in `buffer_open'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:212:in `block in open_loop'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:210:in `catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:210:in `open_loop'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:151:in `open_uri'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/open-uri.rb:717:in `open'
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/gpg-suite-nightly.rb:7:in `block (2 levels) in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/url.rb:10:in `block in from'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl/stanza_proxy.rb:8:in `block in once'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl/stanza_proxy.rb:21:in `to_s'
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/gpg-suite-nightly.rb:12:in `block in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:32:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:32:in `initialize'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:31:in `new'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:31:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:67:in `cask'
/usr/local/Homebrew/Library/Homebrew/compat/hbc/cask_loader.rb:10:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:113:in `cask'
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/gpg-suite-nightly.rb:1:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:16:in `block in each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:15:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:15:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/search.rb:46:in `map'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/search.rb:46:in `search'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/search.rb:8:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:98:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:101:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:179:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:179:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:156:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:101:in `<main>'

Output of brew cask doctor

$ brew cask doctor
==> Homebrew-Cask Version
Homebrew-Cask 1.6.2-33-g27ec9da
caskroom/homebrew-cask (git revision 003c4; last commit 2018-04-26)
==> macOS
10.13.4
==> SIP
Enabled
==> Java
1.8.0_162
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Cached Downloads
~/Library/Caches/Homebrew/Cask (13 files, 1.4GB)
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask (3956 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-drivers (143 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions (176 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/universal-darwin9.0
==> Environment Variables
LC_ALL="en_US.UTF-8"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/bin/bash"

Output of brew tap

$ brew tap
caskroom/cask
caskroom/drivers
caskroom/versions
homebrew/core
homebrew/dupes
homebrew/python
homebrew/science

Most helpful comment

Try brew prune. I had the same issue, pruning deleted some empty directories that were maybe misleading Ruby, like /usr/local/etc/openssl/certs. Afterward brew cask was functioning again.

Note: no proxy in play in my case, but brew cask was nonetheless broken after Homebrew recently migrated itself to this portable-ruby.

All 8 comments

Does brew search work?

Yup...

$ brew search qt
==> Searching local taps...
qt ✔               [email protected]             qtfaststart        seqtk
pyqt               qtads              qtkeychain         sqtop
==> Searching taps on GitHub...
caskroom/cask/qt-creator              caskroom/versions/qt-creator-dev
==> Searching blacklisted, migrated and deleted formulae...

I think brew search uses curl internally, while brew cask search uses native Ruby, which doesn't use any of the *_PROXY variables.

Thanks for the hint. Did some digging and found that ruby was trying to use a cert file under /usr/local/Homebrew/Library/Homebrew/vendor/portable-openssl directory, which did not exist at all.

Not sure what happened.

Anyway, I removed and reinstalled homebrew and now it looks like it's using the default OSX ruby install, which seems to work fine.

I got exact same issue.

Try brew prune. I had the same issue, pruning deleted some empty directories that were maybe misleading Ruby, like /usr/local/etc/openssl/certs. Afterward brew cask was functioning again.

Note: no proxy in play in my case, but brew cask was nonetheless broken after Homebrew recently migrated itself to this portable-ruby.

Please stop posting the same error over and over again. Those are useless to uncover the problem and make the issue harder to parse. If your error has nothing else to add, posting it is counter-productive.

I’ll deleted the duplicates. if we continue to get those, I’ll have to lock the issue.

brew cask search doesn’t exist anymore. It’s now part of brew search.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CoolTomatos picture CoolTomatos  ·  3Comments

florianletsch picture florianletsch  ·  3Comments

dentarg picture dentarg  ·  3Comments

seanreed1111 picture seanreed1111  ·  3Comments

GeekOnGadgets picture GeekOnGadgets  ·  3Comments