Contents

PSA: eget That Executable From GitHub

tldr: GitHub is where most CLI tools live. eget is a tool that makes it easy to download and install their binaries.

What’s the problem?

I was recently putting together a devcontainer for my team. We based it on Debian, but I realized that most of the interesting software in the devcontainer is only available on GitHub. I was mildly horrified that for every single binary I had to a special song and dance to:

  1. Find the latest release on GitHub
  2. Identify the correct binary package for my platform
  3. Untangle the binary from whatever zip/tarball it was in
  4. possibly chmod +x it
  5. Place in the relevant bin directory

Somehow, I’ve been doing this manually for years without thinking too much about it. But now that I was automating it in a Dockerfile, it was extra gross. For example, I had to write an Ansible playbook to map the current architecture into multiple naming conventions (e.g., one has to map uname architecture like x86_64 into Golang amd64), deal with the fact that some projects (cough ksops cough) have their own conventions, download the release, and then have three different ways to untar/unzip/chmod the downloaded file.

enter eget

I randomly stumbled on eget while looking at zyedidia’s GitHub profile (I love his micro editor). It’s a tool that encodes all of these heuristics into a simple command eget owner/repo that downloads the latest release of a GitHub repo into current directory.

The worst part of using eget is that it isn’t published in a distro so one has to do the usual curl ... | sh dance to install it. But once you have it, it no longer matters if you are on macOS, Linux, or Android Termux.. Once it’s installed you will likely have much less curl | sh in your life (except for weird edge cases like pnpm not liking to be dropped in as a binary).

It’s fantastic for interactive use where it will prompt you for clarification if the published binaries are confusingly packaged. It also has various useful options for when heuristics fail. The best part is that it also supports sha256 hashes, so one can use it safely in automation.

Examples of eget putting heuristics to work:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
(base) taras@acer-rtx:/tmp$ eget BurntSushi/ripgrep
https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-x86_64-unknown-linux-musl.tar.gz
Downloading 100% [=========================================================================================================================================================================================] (2.4/2.4 MB, 7.444 MB/s)        
Checksum verified with ripgrep-14.1.0-x86_64-unknown-linux-musl.tar.gz.sha256
Extracted `ripgrep-14.1.0-x86_64-unknown-linux-musl/rg` to `rg`
(base) taras@acer-rtx:/tmp$ eget gohugoio/hugo
4 matches found: please select manually
(1) hugo_0.134.1_linux-amd64.deb
(2) hugo_0.134.1_linux-amd64.tar.gz
(3) hugo_extended_0.134.1_linux-amd64.deb
(4) hugo_extended_0.134.1_linux-amd64.tar.gz
Enter selection number: 4
https://github.com/gohugoio/hugo/releases/download/v0.134.1/hugo_extended_0.134.1_linux-amd64.tar.gz
Downloading 100% [===========================================================================================================================================================================================] (23/23 MB, 8.257 MB/s)        
Extracted `hugo` to `hugo`

GitHub being GitHub

Not all is perfect with eget. Biggest problem is that while GitHub uses a CDN to serve binaries, it does not do the same for api calls to figure out latest release or to list all binaries within a particular release. Since eget uses the GitHub api instead of scraping one ends up running into api call limits pretty quick… unless one sets up a GITHUB_TOKEN, which brings in a whole bunch of security hassles (and still doesn’t raise the api limit sufficiently for large-scale automation). Why GitHub can’t provide release metadata via CDN caching is beyond me.

I think the solution is to set up such a cache on R2 or to scrape GitHub releases. In meantime eget still solves downloading & extracting a binary into place, but I can’t yet use it to figure which asset to download (due to GitHub api limits).

Conclusion

There are issues with GitHub monoculture (like this API gatekeeping, uncertain future policy changes, etc.). However, I’m firmly on the side of using GitHub for everything because projects that use alternatives to GitHub are special snowflakes that make everything harder for me as a user.

For now eget is a fantastically enjoyable way to obtain software that spans every type of computer I use.

HN Feedback

Some good hints re github api, alternatives and a similar tool for Android in HN discussion