brew使用总结

作者: EldonZhao | 来源:发表于2017-01-01 20:05 被阅读3428次

类似于Linux操作系统中的apt-get(Ubuntu)、yum(yum),Mac的操作系统中使用brew(全名Homebrew)解决包依赖问题,可以这样说:Homebew是MacOS不可获取的套件管理器。

一、brew安装

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装过程示例:
[yangweidandeMacBook-Pro:~ zhaoxueyong$ /usr/bin/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 new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/sbin
/usr/local/share
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown zhaoxueyong /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/mkdir -p /Users/zhaoxueyong/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/zhaoxueyong/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown zhaoxueyong /Users/zhaoxueyong/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown zhaoxueyong /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 4336, done.
remote: Compressing objects: 100% (2845/2845), done.
remote: Total 4336 (delta 2252), reused 2802 (delta 1339), pack-reused 0
Receiving objects: 100% (4336/4336), 2.48 MiB | 82.00 KiB/s, done.
Resolving deltas: 100% (2252/2252), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
 * [new tag]         0.1        -> 0.1
 * [new tag]         0.2        -> 0.2
 * [new tag]         0.3        -> 0.3
 * [new tag]         0.4        -> 0.4
 * [new tag]         0.5        -> 0.5
 * [new tag]         0.6        -> 0.6
 * [new tag]         0.7        -> 0.7
 * [new tag]         0.7.1      -> 0.7.1
 * [new tag]         0.8        -> 0.8
 * [new tag]         0.8.1      -> 0.8.1
 * [new tag]         0.9        -> 0.9
 * [new tag]         0.9.1      -> 0.9.1
 * [new tag]         0.9.2      -> 0.9.2
 * [new tag]         0.9.3      -> 0.9.3
 * [new tag]         0.9.4      -> 0.9.4
 * [new tag]         0.9.5      -> 0.9.5
 * [new tag]         0.9.8      -> 0.9.8
 * [new tag]         0.9.9      -> 0.9.9
 * [new tag]         1.0.0      -> 1.0.0
 * [new tag]         1.0.1      -> 1.0.1
 * [new tag]         1.0.2      -> 1.0.2
 * [new tag]         1.0.3      -> 1.0.3
 * [new tag]         1.0.4      -> 1.0.4
 * [new tag]         1.0.5      -> 1.0.5
 * [new tag]         1.0.6      -> 1.0.6
 * [new tag]         1.0.7      -> 1.0.7
 * [new tag]         1.0.8      -> 1.0.8
 * [new tag]         1.0.9      -> 1.0.9
 * [new tag]         1.1.0      -> 1.1.0
 * [new tag]         1.1.1      -> 1.1.1
 * [new tag]         1.1.2      -> 1.1.2
 * [new tag]         1.1.3      -> 1.1.3
 * [new tag]         1.1.4      -> 1.1.4
 * [new tag]         1.1.5      -> 1.1.5
HEAD is now at 760a460 Merge pull request #1754 from MikeMcQuaid/audit-fix-uncommitted-version-scheme

fatal: unable to access 'https://github.com/Homebrew/brew/': Operation timed out after 300020 milliseconds with 0 out of 0 bytes received
Error: Fetching /usr/local/Homebrew failed!
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3805, done.
remote: Compressing objects: 100% (3687/3687), done.
remote: Total 3805 (delta 19), reused 337 (delta 5), pack-reused 0
Receiving objects: 100% (3805/3805), 3.03 MiB | 62.00 KiB/s, done.
Resolving deltas: 100% (19/19), done.
Tapped 3680 formulae (3,834 files, 9.5M)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/zhaoxueyong/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
Failed during: /usr/local/bin/brew update --force
yangweidandeMacBook-Pro:~ zhaoxueyong$ 
yangweidandeMacBook-Pro:~ zhaoxueyong$ /usr/bin/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
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown zhaoxueyong /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at 760a460 Merge pull request #1754 from MikeMcQuaid/audit-fix-uncommitted-version-scheme
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/zhaoxueyong/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://git.io/brew-docs
yangweidandeMacBook-Pro:~ zhaoxueyong$ 

二、brew使用

1.brew帮助:
[yangweidandeMacBook-Pro:~ zhaoxueyong$ brew help
Example usage:
  brew search [TEXT|/REGEX/]
  brew (info|home|options) [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install -vd FORMULA

Developers:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
  https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md

Further help:
  man brew
  brew help [COMMAND]
  brew home
2.brew安装套件:
[yangweidandeMacBook-Pro:ColusLifeDemo zhaoxueyong$ brew install tree
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
afflib                checkstyle            flex                  macosvpn              nvm                   sassc                 volatility            wireguard-tools
cdiff                 duply                 freetype              mysql-sandbox         pngpaste              sbcl                  winetricks            x265

==> Downloading https://homebrew.bintray.com/bottles/tree-1.7.0.sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring tree-1.7.0.sierra.bottle.1.tar.gz
🍺  /usr/local/Cellar/tree/1.7.0: 7 files, 113.3K
3.brew查询套件:
[yangweidandeMacBook-Pro:ColusLifeDemo zhaoxueyong$ brew search tree
mvptree                             pstree                              tree ✔                              treecc                              treefrog
4.brew卸载套件:

相关文章

网友评论

    本文标题:brew使用总结

    本文链接:https://www.haomeiwen.com/subject/juzvvttx.html