mazinlabsのブログ

RubyとかCloudとかその辺の記事を書いたり書かなかったり

Homebrew入れてみた

同じパッケージ管理システムのMacportsよりもいいと聞いたのでインストールしてみることにした。


インストールはこれだけ。

% ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/share
==> The following directories will have their group set to staff:
/usr/local/.
/usr/local/bin
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/share

Press enter to continue
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig /usr/local/share
Password:
==> /usr/bin/sudo /usr/bin/chgrp staff /usr/local/. /usr/local/bin /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig /usr/local/share
==> Downloading and Installing Homebrew...
tar: Failed to set default locale
==> Installation successful!
Now type: brew help

インストールとバージョンの確認。

% brew -v
0.8

ヘルプの表示

% brew help
Example usage:
  brew install FORMULA...
  brew uninstall FORMULA...
  brew search [foo]
  brew list [FORMULA...]
  brew update
  brew upgrade [FORMULA...]
  brew [info | home] [FORMULA...]

Troubleshooting:
  brew doctor
  brew install -vd FORMULA
  brew [--env | --config]

Brewing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
  open https://github.com/mxcl/homebrew/wiki/Formula-Cookbook

Further help:
  man brew
  brew home

あとは自分の必要なパッケージをsearchしてinstallすればいいらしい。
とりあえずMacBookにMongoDBを入れてみた。

% brew search mongo
mongo-php  mongodb    mongoose
% brew install mongodb
Warning: You should upgrade to Xcode 3.2.6
Warning: It appears you have Macports or Fink installed
Software installed with other package managers causes known problems for
Homebrew. If formula fail to build uninstall Macports/Fink and reinstall any
affected formula.
==> Downloading http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.8.3.tgz
######################################################################## 100.0%
tar: Failed to set default locale
==> Caveats
If this is your first install, automatically load on login with:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/mongodb/1.8.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

If this is an upgrade and you already have the org.mongodb.mongod.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
    cp /usr/local/Cellar/mongodb/1.8.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Or start it manually:
    mongod run --config /usr/local/Cellar/mongodb/1.8.3-x86_64/mongod.conf
MongoDB 1.8+ includes a feature for Write Ahead Logging (Journaling), which has been enabled by default.
This is not the default in production (Journaling is disabled); to disable journaling, use --nojournal.
==> Summary
/usr/local/Cellar/mongodb/1.8.3-x86_64: 16 files, 94M, built in 27 seconds

をを、確かにMacportsよりも早い気がする!
今度からはHomebrewを使いたいと思います。


参考:404 Error - FC2ブログ