Mac通过homebrew安装rabbitmq

这里使用homebrew安装rabbitmq


1.打开终端,输入安装命令

brew install rabbitmq

安装的时候如果出现下面的错误:

Error: Failed to download resource "erlang"

Download failed: https://homebrew.bintray.com/bottles/erlang-20.2.2.high_sierra.bottle.tar.gz

Warning: Bottle installation failed: building from source.

Error: The following formula:

  erlang

cannot be installed as a binary package and must be built from source.

Install the Command Line Tools:

  xcode-select --install

根据错误提示,应该还需要安装xcode,在终端输入以下命令进行安装:

xcode-select --install


2.安装完成后,又出现一个错误:

Error: The `brew link` step did not complete successfully

The formula built, but is not symlinked into /usr/local

Could not symlink sbin/cuttlefish

/usr/local/sbin is not writable.


You can try again using:

  brew link rabbitmq

/usr/local/sbin没有写的权限,解决办法输入下面的命令 :

sudo chown -R `whoami`:admin /usr/local/sbin

这里参考:

http://blog.blakesimpson.co.uk/read/89-fix-homebrew-error-usr-local-bin-is-not-writable-on-os-x-el-capitan

http://blog.csdn.net/afanyusong/article/details/78538467

输入brew link rabbitmq检查是否成功


3.由于rabbitmq 服务脚本被安装到了/usr/local/sbin下,但是这个路径并不会自动添加到PATH中,因此需要手动将它添加到PATH

编辑bash_profile

vi ~/.bash_profile

输入i进入编辑模式,然后在文件中添加下面的语句:

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

点击esc退出并输入:wq(保存退出)


4.启动rabbitmq

rabbitmq-server

这个启动方法并不会使rabbitmq作为一个服务在后台运行,如果需要的话可以使用下面的命令:

brew services start rabbitmq

访问rabbitmq管理界面

http://localhost:15672/

可以使用rabbitmq默认账号guest登录

参考:

https://www.jianshu.com/p/5eb62a6d249d

http://www.rabbitmq.com/install-homebrew.html

你可能感兴趣的:(RabbitMQ)