RabbitMQ command doesn't exist?

OS: Mac OSX 10.9

I have rabbitmq installed via home brew and when I go to /usr/local/sbin and run rabbitmq-server it states that: rabbitmq-server: command not found even as sudo it states the same error.

How do I get rabbitmq to start if it's not a command? I have also tried chmod +x rabbitmq-server in that directory to get it be an executable, same issue.

64941 次浏览

From the docs:

The RabbitMQ server scripts are installed into /usr/local/sbin. This is not automatically added to your path, so you may wish to add PATH=$PATH:/usr/local/sbin to your .bash_profile or .profile. The server can then be started with rabbitmq-server.

All scripts run under your own user account. Sudo is not required.

You should be able to run /usr/local/sbin/rabbitmq-server or add it to your path to run it anywhere.


Your command failed because, by default, . is not on your $PATH. You went to the right directory (/usr/local/sbin) and wanted to run the rabbitmq-server that existed and had exec permissions, but by typing rabbitmq-server as a command Unix only searches for that command on your $PATH directories - which didn't include /usr/local/sbin.

What you wanted to do can be achieved by typing ./rabbitmq-server - say, execute the rabbitmq-server program that is in the current directory. That's analogous to running /usr/local/sbin/rabbitmq-server from everywhere - . represents your current directory, so it's the same as /usr/local/sbin in that context.

As rabbitmq-server resides in /usr/local/sbin, running this command will enable starting server from anywhere:

export PATH=/usr/local/sbin:$PATH

On mac by this command you can start,restart or stop rabbitmq

brew services start rabbitmq
brew services stop  rabbitmq
brew services restart rabbitmq

My OS: macOS Sierra 10.12.5

My RabbitMQ was installed using:

brew install rabbitmq

And it was installed into /usr/local/Cellar, just in case if someone has same situation with me, you would need to do similarly:

In terminal:

ls /usr/local/Cellar/rabbitmq/

to check which version you have installed, and then add to .bash_profile:

export PATH=/usr/local/Cellar/rabbitmq/<version>/sbin:$PATH

I installed using home brew and I did the following:

brew install rabbitmq. encountered issues cause the installation happened under bin and not /usr/local/sbin

So I did the following: 1. chown -R `whoami`:admin /usr/local/sbin 2. chown -R `whoami`:admin /usr/local/share 3. brew install rabbitmq 4. /usr/local/sbin/rabbitmq-server

And then the server runs and you can login to the management console :

http://localhost:15672/ userame: guest password: guest

I installed using HomeBrew I added this to my bash profile

PATH=$PATH:/usr/local/Cellar

This worked for me

i have read a wonderful article to fix that

simply open your bash_profile or .profile.

sudo nano ./bash_profile

in the begin of the file add PATH=$PATH:/usr/local/sbin, close and save, then write source ~/.bash_profile and lastly restart your terminal.

problem fix it!

http://www.andrewcranston.me/en/engineering/rabbitmq-and-path-variable/

Start the service like this:

brew services start rabbitmq

Or if you don't need to start it as service:

/usr/local/sbin/rabbitmq-server

I have Mac OS version 10.13.6 installed. Somehow I did not have sbin directory present under /usr/local/. On carefully looking I found that for me the rabbitmq-server binary was present here /usr/local/Cellar/rabbitmq/3.7.9/sbin/rabbitmq-server.

In my case the paths /usr/local/sbin/ nor /usr/local/Cellar/rabbitmq/ etc., did not work as Homebrew was putting these all together in a different location.

I opened Finder in my Mac and searched for rabbitmq-server in the search textbox on top right corner of the Finder window.

rabbitmq-server was located under the path below:

/Users/${USER}/homebrew/Cellar/rabbitmq/3.7.15/sbin

So in my ~/.bash_profile , I updated the PATH as below:

export PATH=$PATH:/Users/${USER}/homebrew/Cellar/rabbitmq/3.7.15/sbin

After source ~/.bash_profile

~ $ rabbitmq-server


##  ##
##  ##      RabbitMQ 3.7.15. Copyright (C) 2007-2019 Pivotal Software, Inc.
##########  Licensed under the MPL.  See https://www.rabbitmq.com/
######  ##
##########  Logs: /Users/santoshsindham/homebrew/var/log/rabbitmq/rabbit@localhost.log
/Users/santoshsindham/homebrew/var/log/rabbitmq/rabbit@localhost_upgrade.log


Starting broker...
completed with 6 plugins.

Just add this in your ~/.bash_profile

export PATH=$PATH:/usr/local/opt/rabbitmq/sbin