mac系统里面如何管理安装包?


比如,ubuntu下有apt-get,fedora下有yum。

请问mac系统(osx)里的安装包管理器是什么?如何使用?

包管理 经验 苹果电脑

feixdm 9 years, 1 month ago

最出名的当然是 brew

Brew 是 Mac 下面的包管理工具,通过 Github 托管适合 Mac 的编译配置以及 Patch,可以方便的安装开发工具。 Mac 自带ruby 所以安装起来很方便,同时它也会自动把git也给你装上。官方网站: http://brew.sh

安装完成之后,建议执行一下自检,brew doctor如果看到Your system is ready to brew. 那么你的brew已经可以开始使用了。

安装:

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

自检:

brew doctor

常用命令: (所有软件以PHP5.5为例子)

brew update                        #更新brew可安装包,建议每次执行一下
brew search php55                  #搜索php5.5
brew tap josegonzalez/php          #安装扩展<gihhub_user/repo>   
brew tap                           #查看安装的扩展列表
brew install php55                 #安装php5.5
brew remove  php55                 #卸载php5.5
brew upgrade php55                 #升级php5.5
brew options php55                 #查看php5.5安装选项
brew info    php55                 #查看php5.5相关信息
brew home    php55                 #访问php5.5官方网站
brew services list                 #查看系统通过 brew 安装的服务
brew services cleanup              #清除已卸载无用的启动配置文件
brew services restart php55        #重启php-fpm

注意:brew services 相关命令最好别经常用了,因为可能很快会被移除掉这个命令

➜  ~  brew services restart php55

Warning: brew services is unsupported and will be removed soon. You should use launchctl instead. Please feel free volunteer to support it in a tap.

Stopping php55... (might take a while) ==> Successfully stopped php55 (label: homebrew.mxcl.php55) ==> Successfully started php55 (label: homebrew.mxcl.php55)

Arther answered 9 years ago

Your Answer