I'm trying to create a script to deploy macOS and the last piece that isn't automated is installing Homebrew. Because of the unique scenario where Homebrew shouldn't be installed with
sudo, and it requires both the
return key to be pressed and the users
password, it's become a tricky thing to figure out. I've spent a few hours on this and found other unanswered questions on StackExchange with no luck on getting it completely automated.
echo "Password: " read -s PASSWORD echo $PASSWORD | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The echo skips the request to hit
return but doesn't pass in the password because I'm missing the
-S flag because I shouldn't include sudo when installing Homebrew. I ultimately need a setup that hits command AND passes in the password without using sudo. The rest of my script runs by using
echo $PASSWORD | sudo -S my-command-here... so I'd like to not deviate too far from that scheme if possible.