Last active
April 15, 2025 06:45
-
-
Save graph226/870e4014c1a0e216f47055b0ab5fe5df to your computer and use it in GitHub Desktop.
install_rg.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# バージョンとダウンロード情報(Linux x86_64 向け) | |
RG_VERSION="14.1.1" | |
ARCHIVE="ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl.tar.gz" | |
DOWNLOAD_URL="https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${ARCHIVE}" | |
# 作業ディレクトリ作成 | |
TMP_DIR=$(mktemp -d) | |
cd "$TMP_DIR" | |
echo "📦 Downloading ripgrep ${RG_VERSION}..." | |
curl -LO "$DOWNLOAD_URL" | |
echo "📂 Extracting..." | |
tar xzf "$ARCHIVE" | |
# インストール先ディレクトリ | |
INSTALL_DIR="$HOME/.local/bin" | |
mkdir -p "$INSTALL_DIR" | |
# バイナリをコピー | |
cp ripgrep-*/rg "$INSTALL_DIR" | |
echo "✅ ripgrep ${RG_VERSION} installed to $INSTALL_DIR" | |
# PATHに含まれているか確認 | |
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then | |
echo "⚠️ $INSTALL_DIR is not in your PATH." | |
echo "You can add this line to your ~/.bashrc or ~/.zshrc:" | |
echo 'export PATH="$HOME/.local/bin:$PATH"' | |
fi | |
# 後片付け | |
cd ~ | |
rm -rf "$TMP_DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment