81

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.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
user3379926
  • 3,855
  • 6
  • 24
  • 42

11 Answers11

142

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.

mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81
Nick Rempel
  • 3,022
  • 2
  • 23
  • 31
62

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
Ruli
  • 2,592
  • 12
  • 30
  • 40
Leo
  • 731
  • 5
  • 8
  • In case you're using the Fish shell, add `set PATH $PATH /usr/local/Cellar/rabbitmq/3.7.16/sbin` (with the appropriate version number) to `~/.config/fish/config.fish`. – Kurt Peek Aug 21 '19 at 05:30
39

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

brew services start rabbitmq
brew services stop  rabbitmq
brew services restart rabbitmq
Saurabh Chandra Patel
  • 12,712
  • 6
  • 88
  • 78
35

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

export PATH=/usr/local/sbin:$PATH
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
user2391517
  • 351
  • 3
  • 4
5

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

Akash Yellappa
  • 2,126
  • 28
  • 21
3

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
Anatole ABE
  • 575
  • 1
  • 7
  • 12
3

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.
Santosh Sindham
  • 879
  • 8
  • 18
3

Just add this in your ~/.bash_profile

export PATH=$PATH:/usr/local/opt/rabbitmq/sbin
José Mateus
  • 311
  • 2
  • 5
2

I installed using HomeBrew I added this to my bash profile

PATH=$PATH:/usr/local/Cellar

This worked for me

2

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.

Love Bisaria
  • 167
  • 13
1

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/

jjoselon
  • 2,641
  • 4
  • 23
  • 37