installation

Installation

Install gnaw on your system using one of the methods below.

Prerequisites

Rust (for building from source)

Install via rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Build Tools

Ensure a C compiler is installed:

macOS:

xcode-select --install

Ubuntu/Debian:

sudo apt update
sudo apt install build-essential

CentOS/RHEL:

sudo yum groupinstall "Development Tools"

Installation Methods

Homebrew (Recommended for macOS)

```bash brew tap 10printhello/gnaw ``` ```bash brew install gnaw ``` ```bash gnaw --version ```

From Source

```bash git clone https://github.com/10printhello/gnaw.git cd gnaw ``` ```bash cargo build --release ``` ```bash # Option 1: /usr/local/bin (Recommended) sudo mv target/release/gnaw /usr/local/bin/
# Option 2: ~/.cargo/bin
mv target/release/gnaw ~/.cargo/bin/
```
```bash gnaw --help ```

Development Setup

For contributing to gnaw, set up the development environment:

```bash # with pip pip install pre-commit
# or with Homebrew (macOS)
brew install pre-commit
```
```bash pre-commit install pre-commit install --hook-type commit-msg ``` ```bash pre-commit run --all-files ```

Verification

Test your installation with a simple search:

echo "Hello, gnaw!" | gnaw "gnaw"

Expected output:

1: Hello, gnaw!

Configuration

gnaw supports configuration via a gnaw.toml file. See Configuration for details.

Config File Locations

  • Project-level: gnaw.toml in your project root
  • User-level: $HOME/.config/gnaw/gnaw.toml
  • CLI flags: Always take precedence over config file values

Troubleshooting

If you get permission errors when installing to `/usr/local/bin/`, try: ```bash sudo chown -R $(whoami) /usr/local/bin/ ``` Make sure the installation directory is in your PATH: ```bash echo $PATH # Should include /usr/local/bin or ~/.cargo/bin ``` Ensure you have the latest Rust toolchain: ```bash rustup update cargo clean cargo build --release ```

Uninstallation

Homebrew

brew uninstall gnaw

From Source

sudo rm /usr/local/bin/gnaw
# or
rm ~/.cargo/bin/gnaw

Next Steps