Setting up redis on OSX

dhtmldhtml Posts: 1,019

$ brew install redis

To have launchd start redis now and restart at login:

 brew services start redis

Or, if you don't want/need a background service you can just run:

 redis-server /usr/local/etc/redis.conf


  • dhtmldhtml Posts: 1,019
    edited May 28

    [email protected] ~ % brew services start redis

    ==> Successfully started `redis` (label: homebrew.mxcl.redis)

    [email protected] ~ % redis-cli ping


    Once you get pong, you are pretty much successful

  • dhtmldhtml Posts: 1,019

    Lets setup a php 7.4:

    $ brew install [email protected]

    At this stage, you have redis on your system, but you need the php client. So you need to run this:

    git clone
    cd phpredis
    phpize && ./configure && make && sudo make install

    Add in your php.ini

    Restart your server:

    $ sudo apachectl restart

    Then run phpinfo in your browser, you should see this:

  • dhtmldhtml Posts: 1,019

    Create redis.php and run:


      //Connecting to Redis server on localhost

      $redis = new Redis();

      $redis->connect('', 6379);

      echo "Connection to server sucessfully<br/>";

      //check whether server is running or not

      echo "Server is running: ".$redis->ping();


    Your response should be:

    Connection to server sucessfully

    Server is running: 1

Sign In or Register to comment.