mac brew安装

最近在Mac上安装python3,在网上找了下,基本上是需要先安装homebrew,安装brew并不是有多难,而是官方给的方法在天朝不太实用(用了fq也不管用),在网上找了很多资料,然而给的答案基本上都是官方给的命令行,作为在天朝的我,一行简单的脚本试了好几次,都不能正常的安装,后来尝试用国内的镜像地址,虽然也尝试了好多次,最后终于有了结果,安装成功了,在这里记录下来,方便后来者不用浪费那么多时间来安装这个并没有太难的工具。


官方的安装方式,喜欢的小伙伴可以试试:

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

用国内的镜像安装的过程如下:
1.将安装brew的文件下载到本地

cd ~ && curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

2.修改安装文件内的镜像源(BREW_REPO和CORE_TAP_REPO)

#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
# This script installs to /usr/local only. To install elsewhere you can just
# untar https://github.com/Homebrew/brew/tarball/master anywhere you like or
# change the value of HOMEBREW_PREFIX.
HOMEBREW_PREFIX = "/usr/local".freeze
HOMEBREW_REPOSITORY = "/usr/local/Homebrew".freeze
HOMEBREW_CACHE = "#{ENV["HOME"]}/Library/Caches/Homebrew".freeze
HOMEBREW_OLD_CACHE = "/Library/Caches/Homebrew".freeze

#BREW_REPO = "https://github.com/Homebrew/brew".freeze
BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freeze

#CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze
CORE_TAP_REPO = "git://mirrors.ustc.edu.cn/homebrew-core.git".freeze

3.执行安装

/usr/bin/ruby ~/brew_install

4.添加执行路径

    sudo vim /etc/profile
    添加/etc/local/bin到PATH
    source /etc/profile

5.验证是否安装成功

brew doctor

如果未提示command not found,则表示安装成功


转自:https://blog.csdn.net/banche163/article/details/79250482

猜你喜欢

转载自blog.csdn.net/linhai1028/article/details/81200025