How to Install Sshpass on Mac?

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.

8

11 Answers

There are instructions on how to install sshpass here:

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

curl -L  > sshpass.rb && brew install sshpass.rb && rm sshpass.rb
4

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

8

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

brew install esolitos/ipa/sshpass
2

Following worked for me

curl -O -L   && tar xvzf sshpass-1.06.tar.gz
cd sshpass-1.06/
./configure
sudo make install
1

Solution provided by lukesUbuntu from github works for me:

Just use brew

$ brew install 
4

Please follow the steps below to install sshpass in mac.

curl -O -L  && tar xvzf sshpass-1.06.tar.gz

cd sshpass-1.06

./configure

sudo make install
0

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

curl -O -L  && tar xvzf sshpass-1.05.tar.gz

//This creates a directory sshpass-1.05

cd sshpass-1.05
./configure
make
sudo make install

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.

Just a slight update from the previous answer

curl -O -L   && tar xvzf sshpass-1.09.tar.gz
cd sshpass-1.09/
./configure
sudo make install

This Worked as on OCT 2021

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  -o sshpass.tar.gz && tar xvzf sshpass.tar.gz
cd sshpass-*
./configure
sudo make install
1

Aargh, the problem with the outdated links. Simply go to 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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest