How to install Homebrew on OS X?

后端 未结 13 1247
花落未央
花落未央 2020-12-07 08:13

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

         


        
相关标签:
13条回答
  • 2020-12-07 08:39

    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

    0 讨论(0)
  • 2020-12-07 08:42

    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.

    0 讨论(0)
  • 2020-12-07 08:43

    Open Terminal and put below command.
    Install:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    Uninstall:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    

    Once install complete after entering brew commands:

    brew install wget
    brew install node
    brew install watchman
    ...
    ...
    
    0 讨论(0)
  • 2020-12-07 08:43

    Here's the script:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    0 讨论(0)
  • 2020-12-07 08:44

    Brew has now been rewritten in Bash!

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    
    0 讨论(0)
  • 2020-12-07 08:44

    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
    ...
    
    0 讨论(0)
提交回复
热议问题