How to install sshpass on Mac?

MacosSshSshpass

Macos Problem Overview


I would like to automate ssh login from my Mac.

It does have a simple solution:

sshpass -p my_password ssh m_username@hostname

But my problem is installing sshpass on my Mac.

Macos Solutions


Solution 1 - Macos

There are instructions on how to install sshpass here:

https://gist.github.com/arunoda/7790979

For Mac you will need to install xcode and command line tools then use the unofficial Homewbrew command:

curl -L https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb > sshpass.rb && brew install sshpass.rb && rm sshpass.rb

Solution 2 - Macos

Update 2022: Unfortunately, Aleks Hudochenkov is no longer updating his repo. There are a bunch of other repos on GitHub that purport to contain a Homebrew recipe for sshpass. It's up to you which of them (if any) to trust.

Some years have passed and there is now a proper Homebrew Tap for sshpass, maintained by Aleks Hudochenkov. To install sshpass from this tap, run:

brew install hudochenkov/sshpass/sshpass

Tap source

Solution 3 - Macos

Another option in 2020 is this homebrew tap, maintained by esolitos

brew install esolitos/ipa/sshpass

Solution 4 - Macos

Following worked for me

curl -O -L  https://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz && tar xvzf sshpass-1.06.tar.gz
cd sshpass-1.06/
./configure
sudo make install

Solution 5 - Macos

Solution provided by lukesUbuntu from github works for me:

Just use brew

$ brew install http://git.io/sshpass.rb

Solution 6 - Macos

Please follow the steps below to install sshpass in mac.

curl -O -L https://fossies.org/linux/privat/sshpass-1.06.tar.gz && tar xvzf sshpass-1.06.tar.gz

cd sshpass-1.06

./configure

sudo make install

Solution 7 - Macos

I just followed the instructions from this article and it helped,

curl -O -L http://downloads.sourceforge.net/project/sshpass/sshpass/1.05/sshpass-1.05.tar.gz && tar xvzf sshpass-1.05.tar.gz

//This creates a directory sshpass-1.05

cd sshpass-1.05
./configure
make
sudo make install

Solution 8 - Macos

For the simple reason:

Andy-B-MacBook:~ l.admin$ brew install sshpass
Error: No available formula with the name "sshpass"
We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security.

Thus, the answer to do the curl / configure / install worked great for me on Mac.

Solution 9 - Macos

Just a slight update from the previous answer

curl -O -L  https://fossies.org/linux/privat/sshpass-1.09.tar.gz && tar xvzf sshpass-1.09.tar.gz
cd sshpass-1.09/
./configure
sudo make install

This Worked as on OCT 2021

Solution 10 - Macos

I found that most of the answers listed here are out of date. To install the latest, I ran this and downloaded directly from sourceforge.net, based on other answers here.

curl -L https://sourceforge.net/projects/sshpass/files/latest/download -o sshpass.tar.gz && tar xvzf sshpass.tar.gz
cd sshpass-*
./configure
sudo make install

Solution 11 - Macos

Aargh, the problem with the outdated links. Simply go to https://sourceforge.net/projects/sshpass/ Download latest version and then tar xvzf it and finally cd to the dir where it got unpackedand install with: ./configure make sudo make install I suppose this will also work on every OS with supported C sdk installed...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAltView Question on Stackoverflow
Solution 1 - MacosJSimonsenView Answer on Stackoverflow
Solution 2 - MacossmammyView Answer on Stackoverflow
Solution 3 - MacosshiramyView Answer on Stackoverflow
Solution 4 - MacosSuresh KumarView Answer on Stackoverflow
Solution 5 - MacosSHI Zhong PingView Answer on Stackoverflow
Solution 6 - MacosSuperNovaView Answer on Stackoverflow
Solution 7 - MacosTom TaylorView Answer on Stackoverflow
Solution 8 - Macosuser1318024View Answer on Stackoverflow
Solution 9 - MacosAlvis FView Answer on Stackoverflow
Solution 10 - MacostcbcwView Answer on Stackoverflow
Solution 11 - Macosuser17049499View Answer on Stackoverflow