ruby 安装 Homebrew 时出错 - 找不到 Brew 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14288682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error Installing Homebrew - Brew Command Not Found
提问by RossPW
I've spent the bulk of my Friday trying to get the latest version of Ruby installed on my new MacBook Air (w/ Mountain Lion installed).
我星期五的大部分时间都在尝试在我的新 MacBook Air(安装了 Mountain Lion)上安装最新版本的 Ruby。
I have all the latest versions of XCode and command line tools. But I can't seem to get Homebrew to work! Here's a screenshot of where I keep getting stuck(I'm a new user, so can't embed this image).
我拥有所有最新版本的 XCode 和命令行工具。但我似乎无法让 Homebrew 工作!这是我一直卡住的屏幕截图(我是新用户,因此无法嵌入此图像)。
As you can see I used the following to instal Homebrew:
如您所见,我使用以下内容来安装 Homebrew:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go/install)"
While there was a "warning" it seemed as though the installation worked:
虽然有一个“警告”,但似乎安装工作正常:
Warning: /usr/local/bin is not in your PATH.
==> Installation successful!
Despite that, when I try to run "brew doctor" I received the following:
尽管如此,当我尝试运行“brew doctor”时,我收到了以下信息:
-bash: brew: command not found
Again, I'm trying to install homebrew, so i can instal the latest version of ruby -- I'm looking to learn to code in ruby, but kind of screwed if I can even get a development environment running! :)
同样,我正在尝试安装自制软件,所以我可以安装最新版本的 ruby——我正在寻找学习用 ruby 编写代码的方法,但是如果我什至可以运行开发环境,那就有点搞砸了!:)
回答by Daniel Evans
The warning is telling you what is wrong. The problem is that brewis kept in /usr/local/bin
警告告诉您出了什么问题。问题brew是保留在/usr/local/bin
So, you can try /usr/local/bin/brew doctor
所以,你可以试试 /usr/local/bin/brew doctor
To fix it permanently alter your bash profile (.bashrc or .profile in your home directory) and add the following line:
要永久修复它,请更改您的 bash 配置文件(主目录中的 .bashrc 或 .profile)并添加以下行:
export PATH=/usr/local/bin:$PATH
回答by Viji
Check XCode is installed or not.
检查 XCode 是否安装。
gcc --version
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
http://techsharehub.blogspot.com/2013/08/brew-command-not-found.html"click here for exact instruction updates"
http://techsharehub.blogspot.com/2013/08/brew-command-not-found.html“单击此处获取准确的说明更新”
回答by Gary Frey
nano ~/.profile
add these lines:
添加这些行:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
save the file:
保存文件:
Ctrl + Xthen Ythen Enter
Ctrl + X然后Y然后Enter
then render the changes:
然后呈现更改:
source ~/.profile
source ~/.profile
回答by Carl Rossman
This was just happening to me, but none of the suggestions above worked. I changed directories ("cd ~/tmp") and suddenly the command
这只是发生在我身上,但上述建议均无效。我改变了目录(“cd ~/tmp”),突然命令
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
worked for me. Prior to changing directories I had been in a directory that is a Git repository. Perhaps that was interfering with the ruby and Git commands in the Brew install script.
对我来说有效。在更改目录之前,我一直在一个作为 Git 存储库的目录中。也许这会干扰 Brew 安装脚本中的 ruby 和 Git 命令。
回答by Darex1991
You can run in terminal
您可以在终端中运行
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
then install https://github.com/robbyrussell/oh-my-zsh.
然后安装https://github.com/robbyrussell/oh-my-zsh。
When those complate run i.e pico editor pico .zshrcand past those lines:
当那些 complate 运行 ie pico editorpico .zshrc并通过这些行时:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
remember use brew doctor:)
记得使用brew doctor:)


回答by ashutosh kumar
try this
尝试这个
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/linuxbrew/go/install)"
回答by user3132580
You can use this:
你可以使用这个:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
to install homebrew.
安装自制软件。

