To get the binary just download the latest release for your OS/Arch from the release page and put the binary somewhere convenient. lego does not assume anything about the location you run it from.
docker run goacme/lego -h
yay -S lego
Note: only the package manager for Arch Linux is officially supported by the lego team.
cd /usr/ports/security/lego && make install clean
pkg install lego
To install the latest development version from sources, just run:
go get -u github.com/go-acme/lego/v4/cmd/lego
git clone firstname.lastname@example.org:go-acme/lego.git make # tests + doc + build make build # only build