可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm trying to install Homebrew on OS X.
According to the Homebrew site I should type
brew install wget
and all I get is
-bash: brew: command not found
So I've searched StackOverflow and found this answer. The problem, however, is I don't see brew
in /usr/local/bin
.
So, I also added the following line to my .bashrc
file
export PATH=/usr/local/bin:$PATH
But I'm still getting the command not found
error.
How do I get Homebrew installed on OS X?
回答1:
It's on the top of the Homebrew homepage.
From a Terminal prompt:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The command brew install wget
is an example of how to use Homebrew to install another application (in this case, wget
) after brew is already installed.
回答2:
Check XCode is installed or not.
$ 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"
回答3:
On an out of the box MacOS High Sierra 10.13.6
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Gives the following error:
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
Solution: Just add a k to your Curl Options
$ ruby -e "$(curl -fsSLk https://raw.githubusercontent.com/Homebrew/install/master/install)"
回答4:
I might be late to the party, but there is a cool website where you can search for the packages and it will list the necessary command to install the stuff.
BrewInstall is the website.
However you can install wget with the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget
Hope this helps :)
回答5:
add the following in your terminal and click enter then follow the instruction in the terminal. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
回答6:
Here is a version that wraps the homebrew installer in a bash function that can be run from your deployment scripts:
install_homebrew_if_not_present() {
echo "Checking for homebrew installation"
which -s brew
if [[ $? != 0 ]] ; then
echo "Homebrew not found. Installing..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Homebrew already installed! Updating..."
brew update
fi
}
And another function which will install a homebrew formula if it is not already installed:
brew_install () {
if brew ls --versions $1 > /dev/null; then
echo "already installed: $1"
else
echo "Installing forumula: $1..."
brew install $1
fi
}
Once you have these functions defined you can use them as follows in your bash script:
install_homebrew_if_not_present
brew_install wget
brew_install openssl
...
回答7:
Following command doesn't work if your are under proxy.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Instead user following -
ruby -e "$(curl -x http://DOMAIN%5cUSER_NAME:PASSWORD@PROXY:PORT -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Note we have to use %5c instead of "\" Similarly if your password has any special character replace it with unicode e.g for @ use %40
Refer this Unicodes
Replace above command with your own params
DOMAIN - Your Domain
USER_NAME - Your User Name
PASSWORD - password
PROXY - 10.10.10.10
PORT - 8080
回答8:
After I had tried everything described, I looked up into the folder permission of brew in /usr/local/etc/. Somehow the permission were changed and I was not able to open the folder. I changed the folder permissions(with chmod) with same permissions as the other folders and brew start working.
回答9:
Here's the script:
/usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"