Skip to content

Instantly share code, notes, and snippets.

@cyio
Last active July 17, 2019 08:21
Show Gist options
  • Save cyio/e101597bfbfff6369fa601c2b6456e81 to your computer and use it in GitHub Desktop.
Save cyio/e101597bfbfff6369fa601c2b6456e81 to your computer and use it in GitHub Desktop.
Install ripgrep on Debian / Ubuntu
#!/bin/bash
[[ $UID == 0 ]] || { echo "run as sudo to install"; exit 1; }
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed.' >&2
apt install jq -y
fi
REPO="https://github.com/BurntSushi/ripgrep/releases/download/"
RG_LATEST=$(curl -sSL "https://api.github.com/repos/BurntSushi/ripgrep/releases/latest" | jq --raw-output .tag_name)
RELEASE="${RG_LATEST}/ripgrep-${RG_LATEST}-x86_64-unknown-linux-musl.tar.gz"
TMPDIR=$(mktemp -d)
cd $TMPDIR
wget -O - ${REPO}${RELEASE} | tar zxf - --strip-component=1
mv rg /usr/local/bin/
mkdir -p /usr/local/share/man/man1
mv rg.1 /usr/local/share/man/man1/
mv complete/rg.bash-completion /usr/share/bash-completion/completions/rg
mandb
@Compro-Prasad
Copy link

Compro-Prasad commented Jun 9, 2019

complete/rg.bash-completion -> complete/rg.bash

rg.1 -> doc/rg.1

Check if curl is installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment