一般在mac上安装软件大家都是比较喜欢用brew来安装,今天就用brew来安装RabbitMQ。详细信息可以查看官网http://www.rabbitmq.com/install-standalone-mac.html

1.使用brew来安装 RabbitMQ

brew install rabbitmq

看到如下的代码表示RabbitMQ安装成功

localhost:~ lidong$ brew install rabbitmq
Updating Homebrew...
==> Installing dependencies for rabbitmq: jpeg, libpng, libtiff, wxmac, erlang
==> Installing rabbitmq dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.sierra.bottle.2.tar
######################################################################## 100.0%
==> Pouring jpeg-8d.sierra.bottle.2.tar.gz
��  /usr/local/Cellar/jpeg/8d: 19 files, 708.3K
==> Installing rabbitmq dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.28.sierra.bottle
######################################################################## 100.0%
==> Pouring libpng-1.6.28.sierra.bottle.tar.gz
��  /usr/local/Cellar/libpng/1.6.28: 26 files, 1.2M
==> Installing rabbitmq dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.7_1.sierra.bott
######################################################################## 100.0%
==> Pouring libtiff-4.0.7_1.sierra.bottle.tar.gz
��  /usr/local/Cellar/libtiff/4.0.7_1: 248 files, 3.4M
==> Installing rabbitmq dependency: wxmac
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.2_4.sierra.bottle
######################################################################## 100.0%
==> Pouring wxmac-3.0.2_4.sierra.bottle.tar.gz
��  /usr/local/Cellar/wxmac/3.0.2_4: 810 files, 24.6M
==> Installing rabbitmq dependency: erlang
==> Downloading https://homebrew.bintray.com/bottles/erlang-19.2.sierra.bottle.t
######################################################################## 100.0%
==> Pouring erlang-19.2.sierra.bottle.tar.gz
==> Caveats
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

Access them with `erl -man`, or add this directory to MANPATH.
==> Summary
��  /usr/local/Cellar/erlang/19.2: 7,310 files, 280.9M
==> Installing rabbitmq 
==> Using the sandbox
==> Downloading https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitm
######################################################################## 100.0%
==> /usr/bin/unzip -qq -j /usr/local/Cellar/rabbitmq/3.6.6/plugins/rabbitmq_mana
==> Caveats
Management Plugin enabled by default at http://localhost:15672

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

To have launchd start rabbitmq now and restart at login:
  brew services start rabbitmq
Or, if you don't want/need a background service you can just run:
  rabbitmq-server
==> Summary
��  /usr/local/Cellar/rabbitmq/3.6.6: 188 files, 5.8M, built in 9 minutes 12 seconds

注意:

3.RabbitMQ 的启动

进入到 /usr/local/Cellar/rabbitmq/3.6.6,执行

localhost:3.6.6 lidong$ sbin/rabbitmq-server

4.RabbitMQ 启动插件

待RabbitMQ 的启动完毕之后,另起终端进入cd /Users/lidong/javaEE/rabbitmq_server-3.6.6/sbin 。启动插件:

sudo ./rabbitmq-plugins enable rabbitmq_management(执行一次以后不用再次执行)

5.登陆管理界面

浏览器输入:http://localhost:15672/

mac 安装 RabbitMQ_java

账号密码初始默认都为guest

mac 安装 RabbitMQ_java_02

注意:

1、使用brew安装后配置文件在/usr/local/etc下,安装文件在/usr/local/Cellar下
2、没有自动生成rabbitmq.config文件,可以自己创建然后编辑,加入

[
  {rabbit,
   [
    {tcp_listeners, [5672]},
    {tcp_listeners, [{"127.0.0.1", 5672},
        {"::1",       5672}]},
   {log_levels, [{connection, error}, {channel, error}]}
   ]
  }
 ].


3、会出现root用户和当前用户下session不一致情况,将其中一个session复制到另外一个即可,.erlang.cookie,这个文件无写权限,赋予权限修改完成后需要将权限改回去,否则报错。。
4、可以在web页面中添加用户,注意一定要设置可访问vhost