By Alvin Alexander. Last updated: April 13, 2020
If you ever need a Linux/Unix shell command to download and install another command using curl
and sudo
privileges, I just used this command to install a command-line tool named Ammonite:
sudo sh -c '(echo "#!/usr/bin/env sh" && \ curl -L https://github.com/lihaoyi/Ammonite/releases/download/2.0.4/2.13-2.0.4) \ > /usr/local/bin/amm && chmod +x /usr/local/bin/amm' && amm
I show the command on multiple lines, but you can also make it a one-line command, as it is on the Ammonite page. As shown, this runs the sudo
command, which requires your admin password, and then it runs the curl
command inside a Unix/Linux shell environment, writing its output to /usr/local/bin/amm.