Rails 4.1 无法使用 Homebrew 在 Mac OS X Yosemite 上安装 Elasticsearch

Rails 4.1 Unable to install Elasticsearch on Mac OS X Yosemite using Homebrew

想要使用 Elasticsearch,以便我可以为我的应用程序使用 Searchkick gem。在 firefox 上安装了最新版本的 java。安装了 Searchkick gem。但是当我输入 brew install elasticsearch 得到和错误消息

 /usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
    /usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0

已安装 Homebrew,检查我 运行 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 并得到

It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:

有办法解决这个问题还是我必须下载 Elasticsearch 文件并手动安装它?

这似乎是自制软件和 yosemite 的问题。也许这可以帮助? https://apple.stackexchange.com/questions/153790/how-to-fix-brew-after-its-upgrade-to-yosemite