DEV Community

Ryan Glass
Ryan Glass

Posted on

Setting up RabbitMQ for Automated Celery Tasks via Homebrew

The easiest way to install RabbitMQ on macOS is using Homebrew the new and shiny package management system for macOS.

Here's a general step by step guide:

If you don't already have it install Homebrew, you can install it by running the following command in the Terminal:

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

Once Homebrew is installed, you can install RabbitMQ by running this command will download and install RabbitMQ with its dependencies.

brew install rabbitmq
Enter fullscreen mode Exit fullscreen mode

After installation, you might need to add RabbitMQ to your PATH. You can do this by adding the following line to your .bash_profile, .zshrc. This step ensures that you can run RabbitMQ commands from the Terminal.

export PATH=$PATH:/usr/local/sbin
Enter fullscreen mode Exit fullscreen mode

Starting/Stopping the RabbitMQ server

Next, we can start up RabbitMQ using Homebrew, the command below ensures that RabbitMQ will run automatically at login.

brew services start rabbitmq
Enter fullscreen mode Exit fullscreen mode

Optionally, If you would like to verify the installation of RabbitMQ and ensure it's up and running correctly, you can check its status by running the status command, it will provide you information on the RabbitMQ service status.

rabbitmqctl status
Enter fullscreen mode Exit fullscreen mode

Also, if you would like to stop RabbitMQ services for any reason you can use the brew command stop the rabbitmq service.

brew services stop rabbitmq
Enter fullscreen mode Exit fullscreen mode

Running management plugin with RabbitMQ

RabbitMQ also comes with a management plugin that provides a browser-based UI for managing and monitoring your RabbitMQ server. If you would like to monitor the stats of your RabbitMQ server.

rabbitmq-plugins enable rabbitmq_management
Enter fullscreen mode Exit fullscreen mode

After enabling it, you can access the management console through http://localhost:15672/. By default the username and password are both “guest”.

Finally to keep RabbitMQ updated you can use Homebrew commands for update and upgrade

brew update
brew upgrade rabbitmq
Enter fullscreen mode Exit fullscreen mode

If you encounter any issues during setup it might also be worth checking the official RabbitMQ documentation.

Top comments (0)