在Mac上安装Redis

使用Homebrew安装Redis键值存储系统,看起来比memcached更好。

$ brew update
$ brew install redis
Error: Failed executing: make -C src 
If `brew doctor' does not help diagnose the issue, please report the bug:
    https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue

出现错误,要求我运行brew doctor来进行检查。

$ brew doctor redis
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
NOTE: Versions of XCode newer than 4.2 don't include gcc 4.2.x.

==> /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. This is an issue if you eg. brew installed Python.

Consider editing your .bashrc to put:
  /usr/local/bin
ahead of /usr/bin in your PATH.
Some "config" scripts were found in your path, but not in system or Homebrew folders.

`./configure` scripts often look for *-config scripts to determine if software packages
are installed, and what additional flags to use when compiling and linking.

Having additional scripts in your path can confuse software installed via Homebrew if
the config script overrides a system or Homebrew provided script of the same name.

/Applications/MAMP/Library/bin
    curl-config freetype-config libmcrypt-config libpng-config libpng15-config sablot-config xml2-config xslt-config yaz-config

因为被要求将/usr/local/bin放在/usr/bin之前,所以我在.bashrc文件中改变了$PATH的顺序。

$ brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.4.6.tar.gz
File already downloaded in /Users/suin/Library/Caches/Homebrew
==> make -C src
==> Caveats
If this is your first install, automatically load on login with:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/redis/2.4.6/io.redis.redis-server.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/io.redis.redis-server.plist

If this is an upgrade and you already have the io.redis.redis-server.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/io.redis.redis-server.plist
    cp /usr/local/Cellar/redis/2.4.6/io.redis.redis-server.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/io.redis.redis-server.plist

  To start redis manually:
    redis-server /usr/local/etc/redis.conf

  To access the server:
    redis-cli
==> Summary
/usr/local/Cellar/redis/2.4.6: 9 files, 460K, built in 3 seconds

完成了