wget http://download.redis.io/releases/redis-3.0.5.tar.gz
tar xzf redis-3.0.5.tar.gz
mv redis-3.0.5 redis
mv redis /usr/
cd /usr/redis
make
make test
make install
2.指定数据文件保存位置
redis解压目录里有一个配置文件redis.conf ,编辑此配置文件,找到 dir ./ 这一行。redis会将内存中的数据写入文件中,而此配置就是指定数据文件保存的路径。
3.启动服务端
cp /usr/redis/redis.conf /usr/local/etc/
/usr/local/bin/redis-server /usr/local/etc/redis.conf
4.测试客户端
redis-cli
5.自动启动redis server
sudo vi /Library/LaunchDaemons/io.redis.redis-server.plist
内容如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.redis.redis-server</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/redis-server</string>
<string>/usr/local/etc/redis.conf</string>
</array>
<key>RunAtLoad</key><true/> </dict>
</plist>
sudo launchctl load /Library/LaunchDaemons/io.redis.redis-server.plist
sudo launchctl start io.redis.redis-server
sudo launchctl stop io.redis.redis-server
原文地址:http://blog.51cto.com/rhino/2125463