1.使用brew安装最为简单
brew search rabbitmq
==> Searching local taps...
rabbitmq rabbitmq-c
==> Searching taps on GitHub...
caskroom/cask/rabbitmq-app
==> Searching blacklisted, migrated and deleted formulae...
brew install rabbitmq
2.启动RabbitMQ
进入命令行,找到你安装好的命令地方
zhuchaodeMacBook-Pro:sbin zhuchao$ pwd
/usr/local/sbin
zhuchaodeMacBook-Pro:sbin zhuchao$ ls
rabbitmq-defaults rabbitmq-plugins rabbitmqadmin
rabbitmq-env rabbitmq-server rabbitmqctl
zhuchaodeMacBook-Pro:sbin zhuchao$ rabbitmq-server
RabbitMQ 3.6.12. Copyright (C) 2007-2017 Pivotal Software, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
########## Logs: /usr/local/var/log/rabbitmq/rabbit@localhost.log
###### ## /usr/local/var/log/rabbitmq/rabbit@localhost-sasl.log
##########
Starting broker...
completed with 9 plugins.
如果出现错误:
ERROR: epmd error for host localhost: nxdomain (non-existing domain)
请绑定127.0.0.1这个host为localhost。就可以解决了
3.访问RabbitMQ
进入sbin目录
sudo ./rabbitmq-plugins enable rabbitmq_management
就可以了,如果要求你输入密码,可以不用理会。直接在浏览器中范围:http://localhost:15672/
用户名和密码都是guest
4.停止服务
只需要在你启动服务的终端按住:control + c就可以了
completed with 9 plugins.
^CStopping and halting node rabbit@localhost
Gracefully halting Erlang VM