Mac使用终端安装Homebrew(brew)

Homebrew简称brew,OSX上的软件包管理工具,在Mac终端可以通过brew安装、更新、卸载软件。

1、打开终端直接输入下面指令回车:

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


注意:如果当前的用户是管理员,需要对权限进行许可,在执行上面的指令前先执行:sudo chmod -R g+w /usr/local

2、在1中指令回车后会提示“Press RETURN to continue or any other key to abort”(回车继续或者按其他键终止),这是直接回车进入“Downloading and installing Homebrew...”,如果网络不好的话可能会提示“fatal: unable to access 'https://github.com/Homebrew/brew/': SSLRead() return error -9806...等”,没关系重新输入1的指令更新。

3、更新完成后的提示如下图所示:

Mac使用终端安装Homebrew(brew)_第1张图片

4、常用的三条语句搜索(search)、更新(install)、卸载(remove)

搜索:brew search SoftwareName

更新:brew install SoftwareName

卸载:brew remove SoftwareName

SoftwareName 是你需要处理的软件名)

5、下面是我安装时的过程代码(仅供参考):

Last login: Wed May 10 08:44:45 on console
userdeMacBook-Pro:~ lijinkui$ sudo chmod -R g+w /usr/local
Password:
userdeMacBook-Pro:~ lijinkui$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made writable by user only:
/usr/local/share/zsh
/usr/local/share/zsh/site-functions

Press RETURN to continue or any other key to abort

==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> Downloading and installing Homebrew...
fatal: unable to access 'https://github.com/Homebrew/brew/': SSLRead() return error -9806
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force --depth=1
userdeMacBook-Pro:~ lijinkui$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at f1d4c4b Merge pull request #2607 from MikeMcQuaid/travis-ci-tweaks-2
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4408, done.
remote: Compressing objects: 100% (4213/4213), done.
remote: Total 4408 (delta 37), reused 454 (delta 15), pack-reused 0
Receiving objects: 100% (4408/4408), 3.52 MiB | 298.00 KiB/s, done.
Resolving deltas: 100% (37/37), done.
Tapped 4213 formulae (4,451 files, 11MB)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/lijinkui/Library/Caches/Homebre
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
Error: Could not link:
/usr/local/share/man/man1/brew.1

Please delete these paths and run `brew update`.
Error: Could not link:
/usr/local/share/doc/homebrew

Please delete these paths and run `brew update`.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
  http://docs.brew.sh/Analytics.html

==> Next steps:
- Run `brew help` to get started
- Further documentation:
    http://docs.brew.sh
userdeMacBook-Pro:~ lijinkui$ brew update
Already up-to-date.



你可能感兴趣的:(iOS开发工具相关)