Homebrew-core: "Error: undefined method `head?' for nil:NilClass" when attempting to install mongodb

Created on 26 Jul 2017  ·  11Comments  ·  Source: Homebrew/homebrew-core

Please always follow these steps:

  • [X] Confirmed this is a problem with brew installing one, specific formula (not cask) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/Homebrew/caskroom/homebrew-cask/new
  • [X] Ran brew update and retried your prior step?
  • [X] Ran brew doctor, fixed all issues and retried your prior step?
  • [X] Ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [X] If brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

"brew gist-logs mongodb" output:

Error: No logs.

"brew config" output:

HOMEBREW_VERSION: 1.2.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: b5529084906af89827f6d9befd613457a1615918
Last commit: 3 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b9381a551461da1ad224013933f6d676d7443fa9
Core tap last commit: 11 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.13.3 => /usr/local/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.26.0/bin/perl
Python: /usr/bin/python
Ruby: /Users/bthomas/.rbenv/shims/ruby => /Users/bthomas/.rbenv/versions/2.4.1/bin/ruby
Java: 1.8.0_141
macOS: 10.12.6-x86_64
Xcode: N/A
CLT: 8.3.2.0.1.1492020469
X11: N/A

"brew doctor" output:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  python

Please note we will close your issue without comment if you delete or do not fill out the issue checklist and provide ALL the requested information.

Noted.

To help us debug your issue please explain:

  • What you were trying to do (and why)

Attempting to run the command "brew install mongodb"

  • What happened (include command output)
$ brew install mongodb
Error: undefined method `head?' for nil:NilClass
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:55:in `block in owner='
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:53:in `each_value'
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:53:in `owner='
/usr/local/Homebrew/Library/Homebrew/formula.rb:231:in `spec_eval'
/usr/local/Homebrew/Library/Homebrew/formula.rb:188:in `initialize'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `new'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:275:in `factory'
/usr/local/Homebrew/Library/Homebrew/dependency.rb:33:in `to_formula'
/usr/local/Homebrew/Library/Homebrew/dependency.rb:96:in `block in expand'
/usr/local/Homebrew/Library/Homebrew/dependency.rb:83:in `expand'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1473:in `recursive_dependencies'
/usr/local/Homebrew/Library/Homebrew/requirement.rb:214:in `expand'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1479:in `recursive_requirements'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1489:in `runtime_dependencies'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:414:in `runtime_requirements'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:427:in `expand_requirements'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:361:in `compute_dependencies'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:135:in `verify_deps_exist'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:128:in `prelude'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:337:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:223:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:221:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:221:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'

Please note this happens almost immediately (exits in about 1 second).

  • What you expected to happen

mongodb would be installed

  • Step-by-step reproduction instructions (by running brew install commands)

Run the above command.

Most helpful comment

@FlowerWrong What's the output of env | grep HOMEBREW? Can you rerun brew update and try again and if that fails brew update --force and try again (and let us know which one fixes it if one does)? Thanks!

All 11 comments

+1
brew upgrade

Error: undefined method `head?' for nil:NilClass
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:55:in `block in owner='
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:53:in `each_value'
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:53:in `owner='
/usr/local/Homebrew/Library/Homebrew/formula.rb:231:in `spec_eval'
/usr/local/Homebrew/Library/Homebrew/formula.rb:188:in `initialize'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `new'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:224:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:275:in `factory'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:306:in `from_keg'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:289:in `from_rack'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1383:in `block in installed'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1381:in `map'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1381:in `installed'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:37:in `upgrade'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'

@FlowerWrong brew config?

@ilovezfs Sorry. That's blow.

HOMEBREW_VERSION: 1.2.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: b5529084906af89827f6d9befd613457a1615918
Last commit: 3 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b9381a551461da1ad224013933f6d676d7443fa9
Core tap last commit: 8 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.13.3 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/kingyang/.rvm/rubies/ruby-2.3.3/bin/ruby
Java: 1.8.0_102, 1.7.0_80
macOS: 10.12.6-x86_64
Xcode: 8.3.3
CLT: 8.3.2.0.1.1492020469
X11: 2.7.11 => /opt/X11

@FlowerWrong What's the output of env | grep HOMEBREW? Can you rerun brew update and try again and if that fails brew update --force and try again (and let us know which one fixes it if one does)? Thanks!

  1. brew update
Updated 1 tap (homebrew/core).
==> Updated Formulae
convox                       gitlab-ci-multi-runner       jboss-forge                  metabase                     packetbeat                   webpack
cryptol                      go ✔                         kobalt                       metricbeat                   rom-tools                    wiredtiger
dhall-json                   haskell-stack                kubernetes-helm              monax                        rtags                        wireguard-tools
encfs                        heroku                       lxc                          mysql-sandbox                ruby-build                   xsv
filebeat                     hyperscan                    mame                         nnn                          trafficserver
Error: undefined method `head?' for nil:NilClass
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:55:in `block in owner='
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:53:in `each_value'
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:53:in `owner='
/usr/local/Homebrew/Library/Homebrew/formula.rb:231:in `spec_eval'
/usr/local/Homebrew/Library/Homebrew/formula.rb:188:in `initialize'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `new'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:224:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:275:in `factory'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:306:in `from_keg'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:289:in `from_rack'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1383:in `block in installed'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1381:in `map'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1381:in `installed'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:505:in `migrate_formula_rename'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:101:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:101:in `update_report'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'
  1. env | grep HOMEBREW

none output

  1. brew update --force
Already up-to-date.

and now what does brew config show

@ilovezfs

HOMEBREW_VERSION: 1.2.5
ORIGIN: https://github.com/Homebrew/brew
HEAD: f0ca3108f779f7248c4ea38426a4c43ed0e9793f
Last commit: 19 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 7e8385dee0d2eb8c5408a7786ca4657da3e4c905
Core tap last commit: 22 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.13.3 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /Users/kingyang/.rvm/rubies/ruby-2.3.3/bin/ruby
Java: 1.8.0_102, 1.7.0_80
macOS: 10.12.6-x86_64
Xcode: 8.3.3
CLT: 8.3.2.0.1.1492020469
X11: 2.7.11 => /opt/X11

It should be ok now since you're on 1.2.5

I tried brew upgrade. Now it is ok.

👍 good job. thanks.

Updating to 1.2.5 fixed things for me. Thanks so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tejasmanohar picture tejasmanohar  ·  3Comments

bantl23 picture bantl23  ·  3Comments

faraazkhan picture faraazkhan  ·  3Comments

oli-laban picture oli-laban  ·  3Comments

sstadick picture sstadick  ·  4Comments