brew installation of elasticsearch failing

Viewed 3116

Been trying to install ElasticSearch using brew, however, all my attempts fail and error

    Error: An exception occurred within a child process:
  NoMethodError: undefined method `path' for nil:NilClass
Did you mean?  paths

is fired back at me. anyone ever crossed this? brew install --debug output is:

āžœ  ~ brew install --debug elasticsearch
Updating Homebrew...
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/elasticsearch.rb
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -version
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -version
/usr/local/Homebrew/Library/Homebrew/build.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/elasticsearch.rb
Error: An exception occurred within a child process:
  NoMethodError: undefined method `path' for nil:NilClass
Did you mean?  paths
/usr/local/Homebrew/Library/Homebrew/extend/os/mac/extend/ENV/super.rb:112:in `setup_build_environment'
/usr/local/Homebrew/Library/Homebrew/build.rb:88:in `install'
/usr/local/Homebrew/Library/Homebrew/build.rb:196:in `<main>'

thanks!

3 Answers

Eventually it was due to the fact xcode was outdated. Updating xcode fixed the problem.

The instructions for Installing Elasticsearch on macOS with Homebrew on the elastic website suggest using a different formula, namely:

brew tap elastic/tap

then

brew install elastic/tap/elasticsearch-full

or

brew install elastic/tap/elasticsearch-oss

depending on whether you want the non-Free (but still $0.00) or OSS version.

I haven't actually tried that formula myself, but I have just had success on macOS Catalina with brew install openjdk@11 to get the required Java version, then I installed the tarfile of logstash-7.6.2 by hand, making sure to do export JAVA_HOME=/usr/local/opt/openjdk@11 before running the logstash program; I assume the same approach will work with elasticsearch, although the official formula above is probably simpler.

The following is a temporary work-around until Homebrew is fixed.

  1. Disable the Homebrew auto-update by either prefixing your brew commands like this: HOMEBREW_NO_AUTO_UPDATE=1 brew install elasticsearch or setting an environment variable in your Bash .profile as export HOMEBREW_NO_AUTO_UPDATE=1. (I am using the latter.)
  2. If you have Homebrew installed as a GIT repository under /usr/local/Homebrew, go to that directory to review the GIT log. You should see a recent merge to the stable branch introduced new code to super.rb:

    2ae2680 (tag: 2.2.12, stable) Merge pull request #7301 from Bo98/cmake-sdkroot

  3. You want to checkout a previous commit in your /usr/local/Homebrew git repo. This did the trick for me:

    /usr/local/Homebrew> git checkout stable^
    HEAD is now at 6e3a293... Merge pull request #7300 from bayandin/patch-1

CORRECTION! The "stable" branch moved recently to 2.2.13. The commit history still contains the problem commit: 2ae2680 (tag: 2.2.12) Merge pull request #7301 from Bo98/cmake-sdkroot.

Checkout the commit-before-the-tag instead.

/usr/local/Homebrew> git checkout -q 2.2.12^
/usr/local/Homebrew> git branch -vv --no-color
* (HEAD detached at 6e3a293) 6e3a293 Merge pull request #7300 from bayandin/patch-1
   master c9ffde6 [origin/master] Merge pull request #7351 from Bo98/branch-encode
   stable 3d9cf83 Merge pull request #7346 from Bo98/pr-pull
  1. When you are ready to undo the changes in step #3, running brew update will checkout the stable branch (at whatever state that will be).
Related