Homebrew的安装

简介

Homebrew官网:brew.sh/index_zh-cn…

Homebrew是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件,相当于linux下的apt-get、yum神器;Homebre可以在Mac上安装一些OS X没有的UNIX工具,Homebrew将这些工具统统安装到了 /usr/local/Cellar 目录中,并在 /usr/local/bin 中创建符号链接。

Homebrew的安装

Homebrew的安装很简单,只需在终端下输入如下指令:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
复制代码

打开终端窗口, 粘贴以上脚本。

  ==> This script will install:
/usr/local/bin/brew
.....中间省略
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
....中间省略
==> The following directories will have their owner set to zh:
/usr/local/.
/usr/local/bin
......中间省略
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
......中间省略

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/share/usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7


==> Installation successful!
==> Next steps
Run `brew help` to get started
Further documentation: https://git.io/brew-docs
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here: https://git.io/brew-analytics
复制代码

脚本会解释它的作用,然后在您的确认下执行安装。高级安装选项请看 这里(需要10.5)。

Homebrew能干什么?

又提示缺少套件啦?别担心,Homebrew 随时守候

$ brew install wget
复制代码

Homebrew 会将套件安装到独立目录,并将文件软链接至/usr/local。

  $ cd /usr/local$ find CellarCellar/wget/1.16.1Cellar/wget/1.16.1/bin/wgetCellar/wget/1.16.1/share/man/man1/wget.1$ ls -l binbin/wget -> ../Cellar/wget/1.16.1/bin/wget
复制代码

Homebrew 的所有文件均会被安装到预定义目录下,所以您无需担心 Homebrew 的安装位置。

轻松创建您的 Homebrew 程式。

  $ brew create https://foo.com/bar-1.0.tgzCreated /usr/local/Library/Formula/bar.rb
复制代码

以 git、 ruby 为其筋骨,所以借助您的相关知识,自由修改,并且可以简单撤回您的调改或者合并上游更新。

  $ brew edit wget # 使用 $EDITOR 编辑!
复制代码

Homebrew 的程式都是简单的 Ruby 脚本:

  class Wget < Formula homepage "https://www.gnu.org/software/wget/" url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz" sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd" def install system "./configure", "--prefix=#{prefix}" system "make", "install" endend
复制代码

Homebrew 使 OS X 更完美。使用 gem  来安装 gems、用brew  来搞定那些依赖包。

更多文档

git.io/brew-docs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值