Skip to content

Instantly share code, notes, and snippets.

@rupeshtiwari
Last active March 12, 2024 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rupeshtiwari/4bcc62c54f4d886e34eb222b622d8dbd to your computer and use it in GitHub Desktop.
Save rupeshtiwari/4bcc62c54f4d886e34eb222b622d8dbd to your computer and use it in GitHub Desktop.
install redis on macos

Installing and running Redis on macOS can be done in several ways, including using Homebrew (a package manager for macOS), downloading and compiling from source, or running it as a Docker container. The simplest method for most users is via Homebrew.

Installing Redis with Homebrew:

  1. Install Homebrew: If you don't already have Homebrew installed on your Mac, open the Terminal app and run the following command. This script installs Homebrew itself.

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    Follow the on-screen instructions to complete the installation.

  2. Install Redis: Once Homebrew is installed, you can easily install Redis by running the following command in the Terminal:

    brew install redis

image

  1. Start Redis: After installing Redis, you can start it using Homebrew's services start command:

    brew services start redis

    This command will start Redis as a background service, which means Redis will automatically start every time you boot your computer unless you stop the service manually.

image

  1. Verify Redis is Running: You can check that Redis is running correctly by using the redis-cli tool, which is a command-line interface to interact with Redis. Run the ping command, and you should receive a PONG response if Redis is running:

    redis-cli ping

image

image

Stopping Redis (if needed):

  • To stop the Redis service you started with Homebrew, run:

    brew services stop redis

Uninstalling Redis (if needed):

  • If you ever need to uninstall Redis, you can use Homebrew to remove it:

    brew uninstall redis
    brew cleanup
  • To remove the Redis service from starting automatically, you can run:

    brew services stop redis

This process installs Redis on your macOS and sets it up to run as a background service, making it easy to start working on applications that require Redis without having to manually start and stop the Redis server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment