2017/10/1

mac MQTT(mosquitto)安裝

請先安裝Homebrew,要用Homebrew安裝mosquitto

安裝mosquitto
$ brew intall mosquitto
我安裝過程有出現一些Error訊息,所以安裝完後又把mosquitto刪掉,相依的套件也跟著刪掉再重新安裝一次。
Homebrew會裝在/usr/local/Cellar/mosquitto這個位置

把mosquitto加入.zshrc環境變數,這樣才可以在全域下指令操作它
打開.zshrc
$ vi .zshrc

在上面加入這行
export PATH=/usr/local/Cellar/mosquitto/1.4.14_1/sbin:$PATH

馬上讓.zshrc生效
$ source .zshrc



用brew啟動mosquitto服務
$ brew services start mosquitto

用brew停止mosquitto服務
$ brew services stop mosquitto

用brew重啟mosquitto服務
$ brew services restart mosquitto

沒有留言:

張貼留言