SaltStack Quickstart Guide on Mac OS X

As always, refer to the official SaltStack documentation first.

To get up and running with SaltStack on Mac OS X can be a daunting task. I have found it much easier to use MacPorts to accomplish any such tasks.

Step 1: Install MacPorts on your Mac OS X. I find this to be an essential step for any developer using Mac OS X. Of course, there’s Homebrew as an alternative. I haven’t used it but you may check it out as well.

Once you have setup MacPorts successfully you are ready to begin. Of course, since MacPorts provides a variety of GCC versions I prefer it over the default gcc provided on my Mac. Install a newer GCC and link your system to it.

[user@host ~] $ sudo port install gcc48

[user@host ~] $ sudo mv /usr/bin/gcc /usr/bin/gcc.orig

[user@host ~] $ sudo ln -s /opt/local/bin/gcc-mp-4.8 /usr/bin/gcc

Install Python 2.7.

[user@host ~] $ sudo port install python27

Install Virtualenv.

[user@host ~] $ sudo port install py27-virtualenv

M2Crypto is a requirement for SaltStack and you need to install SWIG. Otherwise you may get errors[1].

[user@host ~] $ sudo port install swig

[user@host ~] $ sudo port install swig-python

Create your virtualenv.

[user@host ~] $ /opt/local/bin/virtualenv-2.7 ~/dev/virt-env/salt-virt

Activate the virtualenv.

[user@host ~] $ source ~/dev/virt-env/salt-virt/bin/activate

Install SaltStack pre-requisites.

(salt-virt)[user@host ~] $ pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil

Install SaltStack.

(salt-virt)[user@host ~] $ pip install salt

Make sure things are working well.

(salt-virt)[user@host ~] $ python

Python 2.7.8 (default, Jul 13 2014, 17:11:32) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import salt
>>> ^D

To deactivate the virtualenv,


Note: this post was created using Mac OS X 10.9 (Mavericks) with SaltStack 2014.1.7.

[1] Possible SWIG error

unable to execute 'swig': No such file or directory

error: command 'swig' failed with exit status 1

Comments are closed.

%d bloggers like this: