• 首页
  • mac
  • brew mac osx 上软件包管理工具

brew mac osx 上软件包管理工具

brew.jpeg

今天推荐 Mac OSX 下,方便高效的包管理工具 brew

brew 的全名叫做 Homebrew


它的功能类似于 ubuntu 下同下 apt-get ,或者 Cent OS 下的 yum 等包管理工具. 我们可以很方便的 安装,更新,卸载软件


brew 的官网

http://brew.sh/index_zh-cn.html

brew 安装

打开你的 mac 终端命令行工具,输入下面的脚本

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

因为我之前安装过.所以在此输入安装脚本后,提示 Homebrew 已经安装过

➜  /Users/zhangzhi  >ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
   ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

brew 安装软件

brew install 软件名称

我的电脑通过 brew 安装了 nvm 输入下面的脚本运行

➜  /Users/zhangzhi  >brew install nvm

brew 查看已安装的软件

brew list 可以查看所有安装的软件

当你具体想查看某一款软件的时候,可以用 info

brew info 软件名称

比如你可以查看已经安装的 nvm 信息

➜  /Users/zhangzhi  >brew info nvm
nvm: stable 0.26.1 (bottled), HEAD
Manage multiple Node.js versions
https://github.com/creationix/nvm
/usr/local/Cellar/nvm/0.26.1 (3173 files, 56M) *
 Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nvm.rb
==> Caveats
Add NVM's working directory to your $HOME path (if it doesn't exist):

 mkdir ~/.nvm

Copy nvm-exec to NVM's working directory

 cp $(brew --prefix nvm)/nvm-exec ~/.nvm/

Add the following to $HOME/.bashrc, $HOME/.zshrc, or your shell's
equivalent configuration file:

 export NVM_DIR=~/.nvm
 source $(brew --prefix nvm)/nvm.sh

Type `nvm help` for further information.

Bash completion has been installed to:
 /usr/local/etc/bash_completion.d

它列出了已安装软件的版本,开源地址等信息.甚至还贴心的告诉你如何设置环境变量等.

brew 查询软件

可以根据软件名称模糊查询软件信息

brew search git

➜  /Users/zhangzhi  >brew search git
bagit        git-cal      git-flow-avh     git-multipush    git-sh       git-town         gitup        topgit
bash-git-prompt  git-cola     git-ftp      git-now      git-ssh      git-tracker      legit
easy-git     git-crypt    git-gerrit       git-number       git-stree        git-url-sub      libgit2
geogit       git-encrypt      git-hooks    git-octopus      git-subrepo      gitbucket        libgit2-glib
git      git-extras   git-imerge       git-open     git-test         giter8       magit
git-annex    git-fixup    git-integration  git-plus     git-tf       github-release   modgit
git-archive-all  git-flow     git-lfs      git-review       git-tig      gitslave         stgit
homebrew/binary/subgit                Caskroom/cask/digital-power-station       Caskroom/cask/gity
homebrew/emacs/git-messenger              Caskroom/cask/digital             Caskroom/cask/laullon-gitx
homebrew/emacs/git-modes              Caskroom/cask/git-annex               Caskroom/cask/lego-digital-designer
homebrew/fuse/gitfs               Caskroom/cask/git                 Caskroom/cask/logitech-control-center
homebrew/games/git-game               Caskroom/cask/gitbook             Caskroom/cask/logitech-gaming-software
homebrew/head-only/git-hg             Caskroom/cask/gitbox              Caskroom/cask/logitech-harmony
homebrew/head-only/git-svn-abandon        Caskroom/cask/github-desktop          Caskroom/cask/logitech-media-server
homebrew/head-only/git-utils              Caskroom/cask/githubpulse             Caskroom/cask/logitech-myharmony
homebrew/head-only/gitstats           Caskroom/cask/gitifier                Caskroom/cask/logitech-options
homebrew/head-only/willgit            Caskroom/cask/gitify              Caskroom/cask/logitech-unifying
homebrew/tex/git-latexdiff            Caskroom/cask/gitter              Caskroom/cask/rowanj-gitx
homebrew/versions/git-tf-2.0.2            Caskroom/cask/gitup               Caskroom/cask/smartgit
Caskroom/cask/adobe-digital-editions          Caskroom/cask/gitx                Caskroom/cask/snagit

列出了 git 相关的各种软件

brew 卸载软件

brew uninstall 软件名称

brew 其他相关命令

brew update 更新 Homebrew brew home 在浏览器端打开 Homebrew 官网 brew deps 显示包的依赖信息

出自: brew mac osx 上软件包管理工具



回到顶部