OS X 套件管理器安装(Homebrew)

获取 Homebrew

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

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

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

安装过程记录

1.输入命令后会出现如下提示,回车继续安装,按其他任意键退出

Last login: Thu Jul 28 16:39:52 on ttys000

localhost:~ luomeng$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

==> This script will install:

/usr/local/bin/brew

/usr/local/Library/...

/usr/local/share/doc/homebrew

/usr/local/share/man/man1/brew.1

/usr/local/share/zsh/site-functions/_brew

/usr/local/etc/bash_completion.d/brew

==> The following directories will be made group writable:

/usr/local/.

/usr/local/bin

/usr/local/lib

==> The following directories will have their owner set to luomeng:

/usr/local/.

/usr/local/bin

/usr/local/lib

==> The following directories will have their group set to admin:

/usr/local/.

/usr/local/bin

/usr/local/lib

Press RETURN to continue or any other key to abort

2.回车后让你输入你的电脑的密码,密码输入的时候界面不会有任何显示,输完回车即可,接下来就会在自动创建一些文件夹并下载相应的文件。安装完成的时候,你可以通过访问:https://git.io/brew-docs  https://git.io/brew-analytics ;一些相关的文档

/usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib

Password:

==> /usr/bin/sudo /usr/sbin/chown luomeng /usr/local/. /usr/local/bin /usr/local/lib

==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin /usr/local/lib

==> /usr/bin/sudo /bin/mkdir -p /Users/luomeng/Library/Caches/Homebrew

==> /usr/bin/sudo /bin/chmod g+rwx /Users/luomeng/Library/Caches/Homebrew

==> /usr/bin/sudo /usr/sbin/chown luomeng /Users/luomeng/Library/Caches/Homebrew

==> Downloading and installing Homebrew...

remote: Counting objects: 530, done.

remote: Compressing objects: 100% (470/470), done.

remote: Total 530 (delta 32), reused 306 (delta 29), pack-reused 0

Receiving objects: 100% (530/530), 785.73 KiB | 142.00 KiB/s, done.

Resolving deltas: 100% (32/32), done.

From https://github.com/Homebrew/brew

* [new branch]      master    -> origin/master

HEAD is now at 97b6a30 test: add default Linux x86_64 bottle.

==> Tapping homebrew/core

Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...

remote: Counting objects: 3717, done.

remote: Compressing objects: 100% (3604/3604), done.

remote: Total 3717 (delta 15), reused 1942 (delta 4), pack-reused 0

Receiving objects: 100% (3717/3717), 2.88 MiB | 278.00 KiB/s, done.

Resolving deltas: 100% (15/15), done.

Checking connectivity... done.

Tapped 3595 formulae (3,743 files, 9.0M)

==> 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

localhost:~ luomeng$

3.输入brew help可以看所有的功能了,在此不做一一解释了

localhost:~ luomeng$ brew help

Example usage:

brew search [TEXT|/REGEX/]

brew (info|home|options) [FORMULA...]

brew install FORMULA...

brew update

brew upgrade [FORMULA...]

brew uninstall FORMULA...

brew list [FORMULA...]

Troubleshooting:

brew config

brew doctor

brew install -vd FORMULA

Brewing:

brew create [URL [--no-fetch]]

brew edit [FORMULA...]

https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md

Further help:

man brew

brew help [COMMAND]

brew home

localhost:~ luomeng$

What Does Homebrew Do?

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

$ brew install wget

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

$ cd /usr/local

$ find Cellar

Cellar/wget/1.16.1

Cellar/wget/1.16.1/bin/wget

Cellar/wget/1.16.1/share/man/man1/wget.1

$ ls -l bin

bin/wget -> ../Cellar/wget/1.16.1/bin/wget

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

轻松创建您的 Homebrew 程式。

$ brew create https://foo.com/bar-1.0.tgz

Created /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"

end

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

原文链接:http://brew.sh/index_zh-cn.html

获取 Homebrew

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

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

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

安装过程记录

Last login: Thu Jul 28 16:39:52 on ttys000

localhost:~ luomeng$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

==> This script will install:

/usr/local/bin/brew

/usr/local/Library/...

/usr/local/share/doc/homebrew

/usr/local/share/man/man1/brew.1

/usr/local/share/zsh/site-functions/_brew

/usr/local/etc/bash_completion.d/brew

==> The following directories will be made group writable:

/usr/local/.

/usr/local/bin

/usr/local/lib

==> The following directories will have their owner set to luomeng:

/usr/local/.

/usr/local/bin

/usr/local/lib

==> The following directories will have their group set to admin:

/usr/local/.

/usr/local/bin

/usr/local/lib

Press RETURN to continue or any other key to abort

file:///Users/luomeng/Library/Containers/com.tencent.qq/Data/Library/Application%20Support/QQ/Users/812610313/QQ/Temp.db/00D00EDB-EF24-4BEA-84C4-59F37A5B0CCA.png

What Does Homebrew Do?

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

$ brew install wget

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

$ cd /usr/local

$ find Cellar

Cellar/wget/1.16.1

Cellar/wget/1.16.1/bin/wget

Cellar/wget/1.16.1/share/man/man1/wget.1

$ ls -l bin

bin/wget -> ../Cellar/wget/1.16.1/bin/wget

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

轻松创建您的 Homebrew 程式。

$ brew create https://foo.com/bar-1.0.tgz

Created /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"

end

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

原文链接:http://brew.sh/index_zh-cn.html

推荐阅读更多精彩内容