After upgrading to Mac OS X El Capitan, hub command stopped working, but 'brew upgrade hub' fixed it

Tadashi Shigeoka ·  Thu, June 2, 2016

Since Mac OS X El Capitan was released and some time has passed, I also upgraded the Mac I use at work to El Capitan.

The title says it all, but after upgrading to El Capitan, the hub command stopped working, but running ‘brew upgrade hub’ fixed it, so if you’re troubled by similar errors, try brew upgrade.

hub command error example

When I tried to create a GitHub pull-request using the hub command as usual, an error I’d never seen before occurred.

$ hub pull-request -h myGitHubRepo:`git symbolic-ref --short HEAD`
/usr/local/bin/hub:75:in `initialize': wrong number of arguments (9 for 1) (ArgumentError)
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1030:in `new'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1030:in `proxy_uri'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1017:in `proxy?'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:868:in `connect'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:851:in `start'
  from /usr/local/bin/hub:473:in `perform_request'
  from /usr/local/bin/hub:588:in `perform_request'
  from /usr/local/bin/hub:437:in `post'
  from /usr/local/bin/hub:371:in `create_pullrequest'
  from /usr/local/bin/hub:1760:in `pull_request'
  from /usr/local/bin/hub:1586:in `run'
  from /usr/local/bin/hub:2514:in `initialize'
  from /usr/local/bin/hub:2518:in `new'
  from /usr/local/bin/hub:2518:in `execute'
  from /usr/local/bin/hub:2569:in `
'

When I searched online, I found an issue that said “Old versions of hub won’t work, so you should run brew upgrade hub,” so I tried that and it solved the problem.

$ brew list | grep hub
hub

$ hub --version
git version 2.1.3
hub version 1.12.2

$ brew upgrade hub
==> Upgrading 1 outdated package, with result:
hub 2.2.3
==> Upgrading hub
==> Downloading https://homebrew.bintray.com/bottles/hub-2.2.3.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring hub-2.2.3.el_capitan.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/hub/2.2.3: 9 files, 10.3M

OS upgrades always cause some kind of trouble.

That’s all from the Gemba.