2018-11-13

安装home-brew

官方给出安装方式

/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,则表示安装成功


可以通过brew安装python3

brew install python3

可以通过brew安装cocoapods

sudo gem install cocoapods

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容