Installing sshpass on OS X

I recently came across ansible and decided to give it a go, actually kind of upset that I never came across it before as I can already imagine quite a few cases when it could have come in handy and saved me a lot of time when it came to running the same command across multiple servers.

I went about installing ansible by using Homebrew which I have installed on my MacBook Air but soon noticed that I was not able to run commands against all the servers since sshpass was not installed on my machine. I figured the easy route would be to use Homebrew and just install it, but just searching for sshpass with Homebrew I was presented with the following error message.

We won't add sshpass because it makes it too easy for novice SSH users to ruin SSH's security.

It would seem that due to security issues they have decided to add sshpass to the Homebrew blacklist so that was not an option. So the only way to get it properly installed was via source.  Using the following steps I was able to download and compile sshpass on my MacBook Air and get to using ansible.

First you need to download the newest sshpass source, at the time of writing it was version 1.05

cd ~/Downloads/
curl -O -L
tar xvzf sshpass-1.05.tar.gz
cd sshpass-1.05

Once downloaded you will simply need to compile, and make sshpass

sudo make install

As long as this completed without error you should now have sshpass installed on your system and you can run the following command to get the version of sshpass.

sshpass -V

After that ansible should work without presenting any errors when being ran.