Differences between revisions 1 and 2
Revision 1 as of 2013-03-13 17:24:38
Size: 5743
Editor: twotwo
Comment: create tool page of Homebrew
Revision 2 as of 2014-10-11 18:03:45
Size: 10611
Editor: twotwo
Comment: Homebrew Cask
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
||See also [[Ruby]] ||
= Homebrew =
Line 2: Line 4:
= Homebrew =
Line 130: Line 131:
== Homebrew的使用经验 == == Skills on Homebrew ==
Line 133: Line 134:
{{{ {{{#!highlight bash numbers=disable
Line 135: Line 136:
man brew # user menu
Line 137: Line 139:
}}}


=== USING HOMEBREW BEHIND A PROXY ===
{{{#!highlight bash numbers=disable
http_proxy=http://<host>:<port> brew install foo
http_proxy=http://<user>:<password>@<host>:<port> brew install foo
ALL_PROXY=socks5://<user>:<password>@<host>:<port> brew install foo
}}}

=== python homebrew by default ===
[[http://stackoverflow.com/questions/5157678/python-homebrew-by-default||target="_blank"]]

{{{#!highlight bash numbers=disable
brew link --overwrite python
Line 176: Line 193:
=== Local Formulas ===

==== sshpass(black list) ====
{{{#!highlight bash numbers=disable
➜ ~ brew install /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/sshpass.rb
➜ attachments brew install /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/sshpass.rb
==> Downloading http://downloads.sourceforge.net/project/sshpass/sshpass/1.05/ss
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/sshpass/1.05
==> make
==> make install
🍺 /usr/local/Cellar/sshpass/1.05: 8 files, 60K, built in 10 seconds
}}}

==== rsync(duplicated) ====
{{{#!highlight bash numbers=disable
➜ ~ brew info /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/rsync.rb
rsync: stable 3.1.1
https://rsync.samba.org/
Not installed
fatal: Not a git repository (or any of the parent directories): .git
From: https://github.com//homebrew/blob/master/../../srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/rsync.rb
==> Dependencies
Build: autoconf ✔
➜ ~ brew install /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/rsync.rb
}}}

==== menumeters(source block by GFW) ====
{{{#!highlight bash numbers=disable
➜ ~ brew cask info /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/menumeters.rb
menumeters: latest
http://www.ragingmenace.com/software/menumeters/
/opt/homebrew-cask/Caskroom/menumeters/latest (89 files, 2.5M)
https://github.com/caskroom/homebrew-cask/blob/master/Casks/menumeters.rb
==> Contents
  MenuMeters Installer.app/Contents/Resources/MenuMeters.prefPane (prefpane)
}}}

== Homebrew Cask ==
Homebrew Cask是Homebrew的一个扩展,用来安装OS X应用。目前应用早已经过千了,据说更新速度也很不错。

=== Get Cask ===
{{{
# just on cmd: brew install caskroom/cask/brew-cask
➜ ~ brew install caskroom/cask/brew-cask
Cloning into '/usr/local/Library/Taps/caskroom/homebrew-cask'...
remote: Counting objects: 77163, done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 77163 (delta 84), reused 106 (delta 67)
Receiving objects: 100% (77163/77163), 22.15 MiB | 43.00 KiB/s, done.
Resolving deltas: 100% (50083/50083), done.
Checking connectivity... done.
Tapped 1 formula
==> Cloning https://github.com/caskroom/homebrew-cask.git
Cloning into '/Library/Caches/Homebrew/brew-cask--git'...
remote: Counting objects: 2272, done.
remote: Compressing objects: 100% (2221/2221), done.
remote: Total 2272 (delta 55), reused 334 (delta 39)
Receiving objects: 100% (2272/2272), 5.15 MiB | 48.00 KiB/s, done.
Resolving deltas: 100% (55/55), done.
Checking connectivity... done.
Note: checking out '096a13ed738cff431e39414bd33420a32f885ff4'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

==> Checking out tag v0.44.0
🍺 /usr/local/Cellar/brew-cask/0.44.0: 2055 files, 8.1M, built in 2.3 minutes
}}}

=== upgrade ===
{{{
brew upgrade caskroom/cask/brew-cask
brew cask -version
}}}

`brew cask home`: open homepage
=== 常用命令 ===
与brew一致: [[https://github.com/caskroom/homebrew-cask/blob/master/USAGE.md||target="_blank"]]
{{{#!highlight bash numbers=disable
# 列出所有可以被安装的软件
brew cask search <name>
brew cask info <name>
brew cask uninstall <name>
}}}

=== 常用软件列表 ===
 * 系统级: virtualbox java tunnelblick(vpn client)
 * 系统监控: menumeters(free)/istat-menu
 * 浏览器:firefox google-chrome
 * IM: rtx qq wechat
 * 输入法: sogouinput
 * 编辑:evernote xmind mou sublime-text
 * media: mplayerx adobe-photoshop-lightroom xee retinacapture
 * 阅读: calibre ichm
{{{
brew cask install alfred\
virtualbox java menumeters tunnelblick\
firefox google-chrome \
evernote xmind mou sublime-text
the-unarchiver sogouinput \
rtx qq wechat \
thunder mplayerx adobe-photoshop-lightroom xee\
}}}
Line 178: Line 305:
Line 181: Line 307:
 * [[http://caskroom.io/||target="_blank"]]
Line 182: Line 309:
[[CategoryMac_OS_X]] CategoryTool [[CategorymacOS]] CategoryTool

See also Ruby

Homebrew

Homebrew 是一个 Mac OS X 下的软件包管理工具。既然已经有了MacPorts 和 Fink,那么为什么还要制造新的轮子呢?

  • MacPorts:是基于源代码的包管理系统,会在系统下另外安装一套编译环境,新安装的软件都依赖自身提供的类库。造成存储冗余,且容易出现多套环境;

  • Fink: 是 Apt 包管理系统在 Mac OS X 下的一个克隆,采用二进制分发,用户直接从 Fink 的仓库中下载安装软件。最大的缺点就是因为缺乏管理人手,软件更新得很不及时;
  • Homebrew:尽可能的利用你的系统里自带的库,只要现有系统有的就不会再次安装;用Git管理;方便灵活的定制化安装;

1. Homebrew的安装、卸载与更新

Refer to https://github.com/mxcl/homebrew/wiki/Installation

1.1. Requirements

  • An Intel CPU
  • OS X 10.6 or higher
  • Command Line Tools for Xcode: xcode-select --install

  • A Bourne-compatible shell for installation (e.g. bash or zsh)

1.2. Install

$ 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/man/man1/brew.1

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
Password:
==> Downloading and installing Homebrew...
remote: Counting objects: 202201, done.
remote: Compressing objects: 100% (54549/54549), done.
remote: Total 202201 (delta 146509), reused 202141 (delta 146467)
Receiving objects: 100% (202201/202201), 42.19 MiB | 31.00 KiB/s, done.
Resolving deltas: 100% (146509/146509), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
HEAD is now at 0049b1a mercurial: update 3.1.2 bottle.
==> Installation successful!
==> Next steps
Run `brew doctor` before you install anything
Run `brew help` to get started

1.3. Uninstall

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

Before Install Available check is : 33,455M,after is 33,415M

/usr/local size from 22M to 50M

1.4. Update

Fetch the newest version of Homebrew from GitHub using git

brew --version
0.9.4

brew update
Updated Homebrew from 32723234 to 32726535.

brew --version
0.9.5

2. Homebrew的使用

2.1. System Structure

ll /usr/local/
Cellar/         # download pkg, can hold multiple version
Library/        #
├── Aliases     #
├── ENV/        # xcode compile tools
├── Formula/    # pkg install config, such as nginx.rb
bin/            # commands
etc/            # configurations
opt/            # current version: mysql@ -> ../Cellar/mysql/5.6.10

2.2. 软件管理

2.2.1. 查看已经安装的软件(list)

brew list

2.2.2. 搜索需要的软件并安装(search&install)

$ brew search rar
gnu-scientific-library     unrar
$ brew install unrar

2.3. Problem Solve

http://stackoverflow.com/questions/12757694/brew-install-maven-404-error

## error info
curl: (56) Recv failure: Operation timed out
Error: Download failed: https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz

brew edit gd
#  url 'https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz'
  url 'http://fossies.org/linux/www/libgd-2.1.0.tar.gz'
brew install gd

2.4. Check Status

$ brew doctor
Warning: Your compilers are different from the standard versions for your Xcode.
If you have Xcode 4.3 or newer, you should install the Command Line Tools for
Xcode from within Xcode's Download preferences.
Otherwise, you should reinstall Xcode.

Install Command Line Tools in Xcode

brew doctor
Your system is raring to brew.

3. Skills on Homebrew

3.1. brew help

##  --build-from-source
man brew  # user menu
brew install NAME  # install software by name
brew doctor        #Troubleshooting

3.2. USING HOMEBREW BEHIND A PROXY

http_proxy=http://<host>:<port> brew install foo
http_proxy=http://<user>:<password>@<host>:<port> brew install foo
ALL_PROXY=socks5://<user>:<password>@<host>:<port> brew install foo

3.3. python homebrew by default

http://stackoverflow.com/questions/5157678/python-homebrew-by-default

brew link --overwrite python

3.4. nginx config

Change Compile info:

#vi /usr/local/Library/Formula/nginx.rb brew edit nginx

  def install                                
    args = ["--prefix=#{prefix}",            
            "--with-http_ssl_module",        
            "--with-pcre",                   
            "--with-ipv6",                   
            "--with-http_stub_status_module", # add here

sudo nginx -s stop
brew uninstall nginx
brew install nginx
sudo nginx
curl http://localhost/status

Nginx Config:

user  liyan admin;

make auto run service

cp /usr/local/Cellar/nginx/1.2.7/homebrew.mxcl.nginx.plist /srv/www/moin/etc/
# vi .plist and remove user info
# To have launchd start nginx at login with root right(port at 80):
ln -sfv /srv/www/moin/etc/homebrew.mxcl.nginx.plist /System/Library/LaunchDaemons/homebrew.mxcl.nginx.plist
# Load nginx manually:
sudo launchctl load /System/Library/LaunchDaemons/homebrew.mxcl.nginx.plist

3.5. Local Formulas

3.5.1. sshpass(black list)

➜  ~  brew install /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/sshpass.rb
➜  attachments  brew install /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/sshpass.rb
==> Downloading http://downloads.sourceforge.net/project/sshpass/sshpass/1.05/ss
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/sshpass/1.05
==> make
==> make install
🍺  /usr/local/Cellar/sshpass/1.05: 8 files, 60K, built in 10 seconds

3.5.2. rsync(duplicated)

➜  ~  brew info /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/rsync.rb
rsync: stable 3.1.1
https://rsync.samba.org/
Not installed
fatal: Not a git repository (or any of the parent directories): .git
From: https://github.com//homebrew/blob/master/../../srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/rsync.rb
==> Dependencies
Build: autoconf ✔
➜  ~  brew install /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/rsync.rb 

➜  ~  brew cask info /srv/www/moin/wiki/datas/main/pages/Homebrew/attachments/menumeters.rb
menumeters: latest
http://www.ragingmenace.com/software/menumeters/
/opt/homebrew-cask/Caskroom/menumeters/latest (89 files, 2.5M)
https://github.com/caskroom/homebrew-cask/blob/master/Casks/menumeters.rb
==> Contents
  MenuMeters Installer.app/Contents/Resources/MenuMeters.prefPane (prefpane)

4. Homebrew Cask

Homebrew Cask是Homebrew的一个扩展,用来安装OS X应用。目前应用早已经过千了,据说更新速度也很不错。

4.1. Get Cask

# just on cmd: brew install caskroom/cask/brew-cask
➜  ~  brew install caskroom/cask/brew-cask
Cloning into '/usr/local/Library/Taps/caskroom/homebrew-cask'...
remote: Counting objects: 77163, done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 77163 (delta 84), reused 106 (delta 67)
Receiving objects: 100% (77163/77163), 22.15 MiB | 43.00 KiB/s, done.
Resolving deltas: 100% (50083/50083), done.
Checking connectivity... done.
Tapped 1 formula
==> Cloning https://github.com/caskroom/homebrew-cask.git
Cloning into '/Library/Caches/Homebrew/brew-cask--git'...
remote: Counting objects: 2272, done.
remote: Compressing objects: 100% (2221/2221), done.
remote: Total 2272 (delta 55), reused 334 (delta 39)
Receiving objects: 100% (2272/2272), 5.15 MiB | 48.00 KiB/s, done.
Resolving deltas: 100% (55/55), done.
Checking connectivity... done.
Note: checking out '096a13ed738cff431e39414bd33420a32f885ff4'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

==> Checking out tag v0.44.0
🍺  /usr/local/Cellar/brew-cask/0.44.0: 2055 files, 8.1M, built in 2.3 minutes

4.2. upgrade

brew upgrade caskroom/cask/brew-cask
brew cask -version

brew cask home: open homepage

4.3. 常用命令

与brew一致: https://github.com/caskroom/homebrew-cask/blob/master/USAGE.md

# 列出所有可以被安装的软件
brew cask search <name>
brew cask info <name>
brew cask uninstall <name>

4.4. 常用软件列表

  • 系统级: virtualbox java tunnelblick(vpn client)
  • 系统监控: menumeters(free)/istat-menu
  • 浏览器:firefox google-chrome
  • IM: rtx qq wechat
  • 输入法: sogouinput
  • 编辑:evernote xmind mou sublime-text
  • media: mplayerx adobe-photoshop-lightroom xee retinacapture
  • 阅读: calibre ichm

brew cask install alfred\
virtualbox java menumeters tunnelblick\
firefox google-chrome \
evernote xmind mou sublime-text
the-unarchiver sogouinput \
rtx qq wechat \
thunder mplayerx adobe-photoshop-lightroom xee\

5. Reference


CategorymacOS CategoryTool

MainWiki: Homebrew (last edited 2014-10-11 18:03:45 by twotwo)