On Arch Linux, the easiest way is to use the GitHub CLI (gh).
Install it if you don’t already have it:
sudo pacman -S github-cli
Then you have several options.
If you want to download the latest release asset (for example, the latest .tar.gz, .AppImage, etc.):
gh release download --repo owner/repo --pattern '*.AppImage'
Example:
gh release download --repo sharkdp/bat --pattern 'bat-*-x86_64-unknown-linux-gnu.tar.gz'
If you know the tag:
gh release download v1.2.3 --repo owner/repo
To download the source code archive of the latest release:
gh release download --repo owner/repo --archive tar.gz
gh release download --repo owner/repo --archive zip
The --archive or --pattern option is required when downloading the latest release without specifying a tag.
If you don’t want to install gh, you can use the GitHub API with curl:
curl -L https://api.github.com/repos/OWNER/REPO/releases/latest
To download the first asset automatically:
curl -s https://api.github.com/repos/OWNER/REPO/releases/latest \
| jq -r '.assets[0].browser_download_url' \
| xargs wget
This approach only requires curl, jq, and wget and works well in scripts. reddit.com