如果安装了macport 就不能安装homebrew ,必须先卸载macport

$ sudo port -f uninstall installed$ sudo rm -rf \/opt/local \/Applications/DarwinPorts \/Applications/MacPorts \/Library/LaunchDaemons/org.macports.* \/Library/Receipts/DarwinPorts*.pkg \/Library/Receipts/MacPorts*.pkg \/Library/StartupItems/DarwinPortsStartup
\/Library/Tcl/darwinports1.0 \/Library/Tcl/macports1.0 \~/.macports

安装:

首先,Homebrew 的原则是“No sudo”,也就是说,既然 Mac OS X (client 版本) 绝大部分情况下都是归你这个有管理员权限的用户,为什么在自己的 /usr/local 下安装程序还需要 sudo 呢?所以,首先:

sudo chown -R `whoami` /usr/local

然后可以正式开始安装,我推荐的安装方式是先用 git-osx-installer 装上 git,然后用 git 安装:

cd /usr/local

git init

git remote add origin git://github.com/mxcl/homebrew.git

git pull origin master

这么做的实际作用是把你的 /usr/local 目录变成了一个本地 git 仓库,只不过这个仓库只跟踪跟 Homebrew 相关的更新,并不影响任何其他软件的安装。

这样安装会在 /usr/local 下创建 Library 这个目录,然后在 /usr/local/bin 中加入 brew 这个 ruby 脚本。



使用:

安装完毕,下面就可以试试了:

brew search

这个命令用来搜索所有可以通过 homebrew 安装的软件,不带任何参数的时候就是列出所有的。可以看到数量已经不少了。

下面就是选择安装,比如我想安装 unrar:

$ brew search rar

gnu-scientific-library     unrar

$ brew install unrar

Warning: It appears you have Macports or Fink installed

Although, unlikely, this can break builds or cause obscure runtime issues.

If you experience problems try uninstalling these tools.

/usr/local/Library/Formula/unrar.rb:3: warning: already initialized constant ALL_CPP

==> Downloading http://www.rarlab.com/rar/unrarsrc-3.9.4.tar.gz

######################################################################## 100.0%

==> g++ -O4 -march=core2 -mmmx -msse3 -w -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE all.cpp -o unrar

/usr/local/Cellar/unrar/3.9.4: 3 files, 320K, built in 13 seconds

可以看到,unrar 被安装到了 /usr/local/Cellar/unrar/3.9.4 这个目录下,但这样我们访问起来显然很不方便,所以 Homebrew 会在 /usr/local/bin 下面创建到 unrar 程序的符号链接,如果安装的是库之类的,也会对应在 /usr/local/lib 这样的目录下创建符号链接。所以这是一套类似 GoboLinux 的软件管理方式。

安装后就可以用 list 命令列出:

$ brew list

pkg-config  unrar



更新:

如果用了一段时间,需要更新同步上游的 Formula,可以简单地:

$ brew update

From git://github.com/mxcl/homebrew

 * branch            master     -> FETCH_HEAD

Updated Homebrew from 60600885 to 60600885.

No formulae were updated.

Homebrew 会通过 git 完成同步。

mac 下的 homebrew的更多相关文章

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

    MAC下安装Homebrew和 @权限的问题 1.Homebrew简介: Homebrew是一个包管理器,用于安装Apple没有预装但你需要的UNIX工具.(比如著名的wget). Homebrew会 ...

  2. MAC下用homebrew安装及配置apache、php和mysql

    我们用到php运行环境的时候总喜欢用集成包,其实在mac下,用homebrew也可以很快的安装这些东西,配置也很简单. homebrew homebrew是mac下的一个包安装管理工具,使用非常简单方 ...

  3. MAC下安装Homebrew和GDB,并解决无法调试问题

    Homebrew官网 http://brew.sh/index_zh-cn.html Homebrew是神马 linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案, ...

  4. Mac 下使用homebrew 安装node后全局安装找不到问题

    Homebrew 是mac上的包管理工具,其官网: http://brew.sh/ 在使用brew安装node之后安装一些常见工具比如 gulp npm install -g gulp 提示安装成功之 ...

  5. Mac下安装Homebrew并升级subversion

    1. 切 Tencent-GuestWiFi2. $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/ins ...

  6. mac下 配置homebrew 和java home

    1.terminal下输入   /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/insta ...

  7. Mac下安装HomeBrew

    本文章为菲利克斯猫(Felix.mao)原创,转载务必在明显处注明:原文链接:http://blog.csdn.net/maojudong/article/details/7918291 1.  前言 ...

  8. Mac 下用homebrew安装配置MongoDB

    ---恢复内容开始--- 1.首先安装homebrew,已有就跳过 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent. ...

  9. Mac下通过homebrew安装maven

    1.安装Homebrew 将以下命令粘贴至终端 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebr ...

随机推荐

  1. PAT甲级——A1101 Quick Sort

    There is a classical process named partition in the famous quick sort algorithm. In this process we ...

  2. UVA--624 CD(01背包+路径输出)

    题目http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  3. docker中使用源码方式搭建SRS流媒体服务

    一.背景 搭建流媒体服务的方式一般会采用nginx+rtmp和srs服务两种,前者是nginx加上插件所用,而后者是专门为了为了流媒体而生,在这一节中我们将从头搭建srs流媒体服务 二. 运行环境 为 ...

  4. 11-2-break

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. springmvc-环境配置-架构-配合mybatis-参数绑定

    1.1. Spring入门 1.1.1. Springmvc是什么 Spring web mvc和Struts2都属于表现层的框架,它是Spring框架的一部分,我们可以从Spring的整体结构中看得 ...

  6. 2019-10-31-C#-dotnet-获取整个局域网的-ip-地址

    title author date CreateTime categories C# dotnet 获取整个局域网的 ip 地址 lindexi 2019-10-31 08:57:55 +0800 2 ...

  7. windows 服务下搭建jsp运行环境

    此处搭建的是运行环境,不是开发环境. 1, 下载sdk 并安装  1.8      http://rj.baidu.com/soft/detail/14459.html?ald 2, 配置环境变量 步 ...

  8. 前端在本地启动服务预览html页面

    在开发移动端项目时浏览器里出来的效果往往到真机上和预想的有出入,在开发过程中知道了一个可以在本地自己启动一个服务器在手机预览的办法. 1.首先在终端安装http. npm i http-server ...

  9. 2018-2019-2-20175332-实验四《Android程序设计》实验报告

    一.Android Stuidio的安装测试 题目要求: 参考http://www.cnblogs.com/rocedu/p/6371315.html#SECANDROID,安装 Android St ...

  10. Schedule(Hackerrank Quora Haqathon)

    题目链接 Problem Statement At Quora, we run all our unit tests across many machines in a test cluster on ...