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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容