Reputation: 2755
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.
Upvotes: 196
Views: 258718
Reputation: 1567
To avoid having to rely on unknown Github repositories (directly or via Homebrew taps) just use MacPorts :)
Just install MacPorts and then type
sudo port install sshpass
The idea is to install sshpass via MacPorts instead of Homebrew.
You can have both Homebrew and MacPorts on the same machine, but be careful as some packages are available on both sources, and in that case you should be consistent in order to avoid conflicts.
In such cases, normally I give priority to Homebrew, but sshpass won't be provided by them, as they explicitly say.
In fact, if you type:
brew install sshpass
Then the output will also include this sentence:
We won't add sshpass because it makes it too easy for novice SSH users to ruin SSH's security.
Then in this case MacPorts is the only choice (if you really want to use sshpass).
Link to the MacPorts project
How to install MacPorts
Link to the sshpass Port on MacPorts
Upvotes: 6
Reputation: 2830
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
Upvotes: 252
Reputation: 1577
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
Upvotes: 12
Reputation: 2692
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
Upvotes: 196
Reputation: 49
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
Upvotes: 2
Reputation: 11
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 unpacked
and install with:
./configure make sudo make install
I suppose this will also work on every OS with supported C sdk installed...
Upvotes: 1
Reputation: 3540
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
Upvotes: 5
Reputation: 833
Another option in 2020 is this homebrew tap, maintained by esolitos
brew install esolitos/ipa/sshpass
Upvotes: 47
Reputation: 712
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
Upvotes: 32
Reputation: 396
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.
Upvotes: 3
Reputation: 27466
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
Upvotes: 9
Reputation: 543
Solution provided by lukesUbuntu from github works for me:
Just use brew
$ brew install http://git.io/sshpass.rb
Upvotes: 18