Homebrew介绍
Homebrew主要用于解决软件依赖包的关系。如其他linux系统Red hat有yum,Ubuntu有apt-get。可以说Homebrew就是mac下的apt-get、yum。
Homebrew安装
1.在终端中输入以下代码:
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
2.安装完毕后,执行命令查看是否安装成功。执行命令:brew
Please run brew update!
3.根据执行brew提示,要求我们执行brew update。那我们就执行
brew update
执行命令会出现这样的错误信息:
Error: /usr/local must be writable!
问题的原因是由于/user/local目录没有权限。这里我们给该目录进行授权。
如:sudo chown -R CalvinMackBook /usr/local```
4.执行:brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 1057, done.
remote: Compressing objects: 100% (968/968), done.
remote: Total 1057 (delta 100), reused 445 (delta 50), pack-reused 0
Receiving objects: 100% (1057/1057), 1.02 MiB | 23.00 KiB/s, done.
Resolving deltas: 100% (100/100), done.
From https://github.com/Homebrew/brew
- [new branch] master -> origin/master
HEAD is now at 9a0116d Merge pull request #2126 from reitermarkus/spec-install
To restore the stashed changes to /usr/local run:
'cd /usr/local && git stash pop'
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
http://docs.brew.sh/Analytics.html
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4158, done.
remote: Compressing objects: 100% (4012/4012), done.
remote: Total 4158 (delta 30), reused 443 (delta 9), pack-reused 0
Receiving objects: 100% (4158/4158), 3.32 MiB | 25.00 KiB/s, done.
Resolving deltas: 100% (30/30), done.
Tapped 4009 formulae (4,189 files, 10.4M)
Already up-to-date.
Error: Could not link:
/usr/local/share/doc/homebrew
Please delete these paths and run brew update
.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Could not link:
/usr/local/share/doc/homebrew
Please delete these paths and run brew update
.
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local
从安装信息我们可以看到,需要我们删除/usr/local/share/doc/homebrew目录,然后再执行安装。
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Could not link:
/usr/local/share/doc/homebrew
Please delete these paths and run `brew update````
执行删除目录的命令:
rm -r -f /usr/local/share/doc/homebrew
继续执行brew update
brew update
5.安装更新成功!
Homebrew基本使用
搜索软件:brew search 软件名
brew search wget
安装软件:brew install 软件名
brew install wget
卸载软件:brew remove 软件名
brew remove wget