Step 1 – Get the source and compile it
curl -O http://redis.googlecode.com/files/redis-1.2.6.tar.gz
tar xvzf redis-1.2.6.tar.gz
cd redis-1.2.6
make
Step 2 – Place the binaries and configure
- copy redis-benchmark, redis-server, redis-cli, and redis-stat to /usr/local/bin and set the owner to root.
- copy redis.conf to /usr/local/etc and change 「daemonize」 to 「yes」
- if you want it to start when the system boots, create redis.plist in ~/Library/LaunchAgents directory with following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.redis</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/redis-server</string>
<string>/usr/local/etc/redis.conf</string>
</array>
</dict>
</plist>
Then use the following command to automatically start when your computer boots
launchctl load ~/Library/LaunchAgents/redis.plist
launchctl start com.redis
Step 3 – Test
- open Redis CLI by entering 「redis-cli」
set joon "rubyhead"
get joon #=> should return "rubyhead"
exit
open Redis CLI again
get joon #=> should return "rubyhead" again