Installing a Salt Minion on MacOS
-
Installing SaltStack's Salt Minion on a modern MacOS system can be quite daunting, especially as none of the existing directions from SaltStack or any site that I have found actually work. Since MacOSX El Capitan released, SIP security has made all traditional installation methods unable to function, and we don't want to be shutting off security to install our Minion. So we need an installation process that actually handles what we need.
First, the only working Salt system that I can find is the one from Homebrew. So we need to install that first to get things to work.
Next we can use brew to install the saltstack package (this will also keep it up to date later on.)
Now comes the big trick, Brew's SaltStack install contains its own Python 2.7 system that is not the same as the ones that get installed by XCode, Brew, PIP, or anything else. This causes a lot of problems. So we need to export an environmental variable so that we can use PIP and have it apply to the correct environment. The salt-minion scripts that Brew has installed already are hard coded to the new installation location so they are okay, but if we don't know that they are doing that, we are pretty lost as to why things aren't working.
Now that we have exported our new path, we can use PIP2 to install psutil that is oddly missing from Brew's install of SaltStack. This is a pretty critical core library and you will have loads of issues without it.
Now, do your normal Salt configuration. MacOS uses /etc/salt the same as Linux for holding the config files.
Lastly, we need to download a configuration for launchctl and set the system to treat Salt Minion as a daemon so that it starts automatically.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install saltstack export PATH="/usr/local/Cellar/saltstack/2017.7.4/libexec/bin/:$PATH" pip2 install psutil # Configure your Salt settings sudo curl -L https://raw.githubusercontent.com/saltstack/salt/develop/pkg/darwin/com.saltstack.salt.minion.plist -o /Library/LaunchDaemons/com.saltstack.salt.minion.plist sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.minion.plist