LoginSignup
11
12

More than 5 years have passed since last update.

HomebrewでOS XにMosquittoをインストールする

Last updated at Posted at 2015-11-07

環境

  • OS X 10.11.1

インストール

brew install mosquitto

設定ファイルは以下に置かれます。

/usr/local/etc/mosquitto/mosquitto.conf

メッセージブローカーの起動

OS起動時にMosquittoを起動したい場合:

ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist

毎回、手動で起動する場合は launchctl の設定を行わず、以下のコマンドで起動する。

/usr/local/opt/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf

動作確認

Mosquittoをインストールすると、一緒に購読用と配信用の簡易クライアントもインストールされます。簡易クライアントで動作を確認しましょう。

以下でトピックを購読します。

/usr/local/bin/mosquitto_sub -t test

別のターミナルを開いて、トピックにメッセージを配信します。

/usr/local/bin/mosquitto_pub -t test -m hello

mosquitto_subでメッセージを受信できたら問題なく動作しています。

11
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
12