Mac下软件包管理器-homebrew

Posted 北海悟空

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac下软件包管理器-homebrew相关的知识,希望对你有一定的参考价值。

类似于redhat系统的yum,ubuntu的apt-get,mac系统下也有相应的包管理容器:homebrew。用法与apt-get、yum大同小异,都是对安装软件做一些安装删除类的命令行操作,以下实例演示通过命令安装homebrew,见到“Installation successful!”则说明安装成功。

tdcqma:awesome-python3-webapp $ ruby -e "$(curl --insecure -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 group writable:
/usr/local/bin
/usr/local/sbin
==> The following existing directories will have their owner set to mahaibin:
/usr/local/bin
/usr/local/sbin
==> The following existing directories will have their group set to admin:
/usr/local/bin
/usr/local/sbin
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/opt
/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/chmod u+rwx /usr/local/bin /usr/local/sbin
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/sbin
==> /usr/bin/sudo /usr/sbin/chown mahaibin /usr/local/bin /usr/local/sbin
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/sbin
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /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 mahaibin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /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/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/mkdir -p /Users/mahaibin/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/mahaibin/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown mahaibin /Users/mahaibin/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 mahaibin /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 6149, done.
remote: Compressing objects: 100% (3769/3769), done.
remote: Total 6149 (delta 3494), reused 4072 (delta 2188), pack-reused 0
Receiving objects: 100% (6149/6149), 3.51 MiB | 27.00 KiB/s, done.
Resolving deltas: 100% (3494/3494), 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.10     -> 1.1.10
 * [new tag]         1.1.11     -> 1.1.11
 * [new tag]         1.1.12     -> 1.1.12
 * [new tag]         1.1.13     -> 1.1.13
 * [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
 * [new tag]         1.1.6      -> 1.1.6
 * [new tag]         1.1.7      -> 1.1.7
 * [new tag]         1.1.8      -> 1.1.8
 * [new tag]         1.1.9      -> 1.1.9
 * [new tag]         1.2.0      -> 1.2.0
 * [new tag]         1.2.1      -> 1.2.1
HEAD is now at fb33acb Merge pull request #2624 from mistydemeo/use_python_flock
==> Tapping homebrew/core
Cloning into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
remote: Counting objects: 4423, done.
remote: Compressing objects: 100% (4228/4228), done.
remote: Total 4423 (delta 37), reused 471 (delta 14), pack-reused 0
Receiving objects: 100% (4423/4423), 3.52 MiB | 22.00 KiB/s, done.
Resolving deltas: 100% (37/37), done.
Tapped 4227 formulae (4,466 files, 11.0MB)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/mahaibin/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:
  http://docs.brew.sh/Analytics.html

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    http://docs.brew.sh
tdcqma:awesome-python3-webapp $ 

homebrew简写为brew,查看一下brew的帮助说明:

tdcqma:awesome-python3-webapp $ 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...]
  http://docs.brew.sh/Formula-Cookbook.html

Further help:
  man brew
  brew help [COMMAND]
  brew home

尝试使用brew进行软件安装

tdcqma:awesome-python3-webapp $ brew install tree
==> 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
==> Using the sandbox
??  /usr/local/Cellar/tree/1.7.0: 7 files, 113.3KB
tdcqma:awesome-python3-webapp $ tree
.
├── LICENSE
├── backup
├── conf
├── dist
├── ios
└── www
    ├── static
    └── templates

7 directories, 1 file

 

以上是关于Mac下软件包管理器-homebrew的主要内容,如果未能解决你的问题,请参考以下文章

MAC下安装Homebrew 和 @权限的问题

Mac下搭建react native开发环境

ReactNative进阶(三十三):Mac下homebrew 的安装和 brew 命令的使用

mac homebrew安装

Mac/Homebrew brew update慢的方法

Mac 配置java 开发环境