启用 sudo rabbitmq-server -detached时遇到的问题:

当在终端执行:sudo rabbitmq-server -detached输入密码时提示 command not found , 而且,刚进终端就显示:user/***/.bash_profileexport no such file or directory ,可是本地只有bash_profile 文件,没有bash_profileexport 文件。

解决办法:

1.先执行open .zshrc 打开文件将其底部的source ~/.bash_profileexport , 改为source ~/.bash_profile ,然后command+s保存后在终端执行:source .zshrc

2.重新打开终端后不显示报错文件了,但是不管是open 命令还是sudo命令都提示 zsh:command not found ,无法打开bash_profile 和zshrc文件,于是在终端执行:

PATH=/bin:/usr/bin:/usr/local/bin:${PATH}

export PATH

然后就可以执行open命令,进入open .zshrc中将以上语句(PATH=/bin:/usr/bin:/usr/local/bin:${PATH}

export PATH)放入其中,然后点击保存,执行source .zshrc应用。

3.因为 zshrc 文件是读取的 bash_profile 文件,所以建议:配置的文件路径从bash_profile 放入到zshrc文件中。

4.找到rabbitmq的安装路径(/usr.local/Cellar/rabbitmq/3.8.9_1)改为/usr/local/Cellar/rabbitmq/3.8.9.1 ,然后相应的zshrc 中的路径也要改,改完后执行source .zshrc,然后在终端再执行 sudo rabbitmq-server -detached,发现错变了!!

如下:

Crash dump is being written to: erl_crash.dump...done

Rabbitmq init terminating in do boot

出现这个问题就是rabbitmq安装路径中有空格的原因,会不会是当时改安装路径文件名导致的呢,再改回/usr/local/Cellar/rabbitmq/3.8.9_1 ,执行source .zshrc,再执行sudo rabbitmq-server -detached 可以了。

总结:无厘头!

参考链接:Mac zsh: command not found zsh 所有命令在终端失效 - 简书

MAC .bash_profile环境变量设置不成功 用zsh ~/.zshrc试一下_哈皮的饶小胖的博客-CSDN博客_open ~/.zshrc

rabbitmq启动方式 - xushukui - 博客园

mac部署rabbitmq流程与异常总结_OneZeroTwoFour-CSDN博客

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐