Install software from GitHub
2022-08-27
Do you often download and install software directly from GitHub? I do.
At home, I usually use my system's package manager for installing software (I use Arch, btw ;-) ).
But when I work in Ubuntu 20.04 LTS (p.e. in the office, on my VPS, in a Docker container), the software I want to install is often not available (in the Ubuntu repos) or outdated. Then I browse to github.com, search for the repository, click on the link to the release page, figure out if a .deb
package is available, check for a .tar.gz
archive otherwise, download it, install it (or extract it and copy the binary to directory which is in the PATH
).
After doing this many times, I decided to automate this process. The result is install-from-github.sh.
install-from-github.sh
install-from-github.sh
is a POSIX compliant shell script that can be used as simple as:
./install-from-github.sh BurntSushi/ripgrep
You just pass a GitHub repository (without https://github.com/
, only user/repo
) as parameter and the script will download the latest package for your system and install it. (It will ask you for your sudo/doas password.)
The first choice is always a deb/rpm/apk package (if you use Ubuntu, Debian, RedHat or Alpine Linux). The second choice is a binary archive (usually .zip
, .tar.gz
or .tar.xz
). Pass --archive-only
if you prefer archives (or when you don't have sudo/doas rights).
You can pass multiple repositories at once. Or a file containing a list of GitHub projects (using --projects FILE
).
The script works by filtering the list of file names available in the current release. These file names don't follow strict rules. This means there is no guarantee this script works for every repository. Just try and if it fails, open an issue.
Only restriction: Currently, the script works only for x86_64
Linux systems.