mac安装redis详细步骤

1,342 阅读1分钟

一、官网链接下载

redis.io/download

image.jpeg

解压redis-3.0.7.tar.gz,拷贝到任意目录,例如/usr/local/。 执行解压命令: tar xzf redis-3.0.7.tar.gz

image.jpeg

二、终端安装

  • 编译和安装

    跳转到“ cd /usr/local/redis/”,然后编译,安装 make
    安装后执行make install,基本安装完,配置都采用默认配置。

  • 启动redis

    cd 到redis解压目录下,执行src/redis-server,回车即启动。 如图所示则启动成功:

image.jpeg

三、关于进程相关的操作

检验进程

查看redis是否启动成功,在终端执行:ps -ef | grep redis 。
看到redis-server进程则成功。 image.jpeg

结束进程

sudo kill PID号
将PID替换为相应的进程号
前提是需要知道进程的PID号

  • 举个栗子: image.jpeg sudo kill 30071
    30071为redis-server进程的PID号

安装中出现问题

  • make install 安装出现问题如下:

image.jpeg

  • 解决方案:mac 安装 pkg-config
1、下载mac最新版[pkg-config
[https://pkg-config.freedesktop.org/releases/](https://pkg-config.freedesktop.org/releases/)
![image.jpeg](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/fe392195bf6f44d2b910400a000a967e~tplv-k3u1fbpfcp-zoom-1.image)
2、解压,终端cd到解压文件夹下
3、运行配置文件进行系统配置:./configure --with-internal-glib
4、编译pkgconfig:make
5、安装包自检测: make check
6、安装: make install