Menu Close

Redis – How to install redis on Mac OS X

Here, We will see How to install redis on Mac OS X. There are many ways to install and use redis on Mac OS X.

Installation by using Homebrew

Command: Run given below command on mac terminal.

brew install redis

During installation, Just ignore the notification messages.

Note: If you do not have brew command, then you can follow given below steps:

  • Download redis from this link
  • Go to inside redis folder
    • $ cd ~/Downloads/redis-2.4.14
  • Run given below command on terminal
    • $ make test
    • $ make
  • Move these 2 directories into your /usr/bin directory
    • $ sudo mv src/redis-server /usr/bin
    • $ sudo mv src/redis-cli /usr/bin
  • Now create redis config file
    • $ mkdir ~/.redis
    • $ touch ~/.redis/redis.conf

Start redis server

There are many ways to start redis server. You can choose any one of them.

Start Redis server using configuration file:

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

By default, redis.conf file persist into 
"/usr/local/etc/redis.conf" location in the 
system.

Start Redis server via “launchctl“:

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Start Redis server on computer starts:

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

Run Redis as a background service:

brew services start redis 

Stop redis server

There are many ways to stop redis server.

brew services stop redis 

Uninstallation by using Homebrew

$ brew uninstall redis
$ rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Get Redis package information.

$ brew info redis

Test if Redis server is running.

$ redis-cli ping

It will reply "pong" message.

To learn more about golang, Please refer given below link:

https://www.techieindoor.com/go-lang-tutorial/

References:

https://golang.org/doc/
https://golang.org/pkg/
Posted in redis

Leave a Reply

Your email address will not be published.

Contact Us