Monday, November 19, 2012

Installing Mosquitto & LibMosquitto for python on Mac OSX 10.8 (Mountain LIon)

Its quite easy, though not many online posts are available. Mosquitto site doesnt give much information apart from suggestion to install it using brew.

First Install Mosquitto using brew
$brew install Mosquitto
it may fail due to wrong perms on /usr/local so change ownership of local dir

$sudo pip install Mosquitto 
To Use Mosquitto from Python

It may give following error
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.1













You need to upgrade Pip as you are using old pip
$sudo easy_install -U pip
and try again

$pip install mosquitto

It works. Confirm it.

$pydoc mosquitto