General macOS setup for development

A focus on things to do, when I setup my Mac for development of iOS Apps and IoT projects.

Homebrew
Visual Studio Code
Command Line
MQTT
Docker

Homebrew

Installation

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Notice: Homebrew installs files in /usr/local/bin

Keep brew updated:

brew update

Add new folder to systems search PATH:

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

Additional packages to install:

brew install python

Command Line

Install oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

MQTT (mosquitto)

Intall mosquitto broker:

brew install mosquitto

To make macOS start the server on startup you need to execute the following command to create a symbolic link (NOT VERIFIED STEP):

ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents

Upon successful installation, you can find the default configuration file in:

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

To (re)start mosquitto after an upgrade:

brew services restart mosquitto

Or, if you don’t want/need a background service you can just run:

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

Check if mosquitto server is running by homebrew:

brew services info mosquitto

Allow external clients to connect to the mosquitto service: Open configuration file and add following lines:

listener 1883
allow_anonymous true

Test if installation was successful

In first command line run to subscribe to our test topic:

mosquitto_sub -t topic/state -h <host-ip>

In second command line run following command to publish a test message:

mosquitto_pub -t topic/state -m "Hello World"

You should see the message “Hello World” printed in your first command line.

References

Docker

Installation

brew install docker