# ast-grep mit Homebrew, apk, MacPorts, Nix, pacman, zypper, scoop, winget installieren

Prüfe Installationswege, Executables, Metadaten und Sicherheitshinweise für ast-grep in AI-Agent-Workflows.

## Installation

```sh
sudo av install brew:ast-grep
```

Weitere Installationsbefehle:

### macOS

- Homebrew (100%):

```sh
brew install ast-grep
```

  Evidenz: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install ast-grep
```

  Evidenz: MacPorts ports tree: devel/ast-grep/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add ast-grep
```

  Evidenz: Alpine Linux edge package indexes: ast-grep from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Nix (92%):

```sh
nix profile install nixpkgs#ast-grep
```

  Evidenz: nixpkgs package indexes: pkgs/by-name/as/ast-grep/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S ast-grep
```

  Evidenz: Arch Linux sync databases: ast-grep from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install ast-grep
```

  Evidenz: openSUSE Tumbleweed package metadata: ast-grep from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/ast-grep
```

  Evidenz: Scoop official bucket manifest trees: bucket/ast-grep.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id ast-grep.ast-grep -e
```

  Evidenz: Windows Package Manager source index: ast-grep.ast-grep from https://cdn.winget.microsoft.com/cache/source.msix

## Paketfakten

- **Paketschlüssel:** brew:ast-grep
- **Paketmanager:** Homebrew
- **Version:** 0.45.0
- **Quellzusammenfassung:** Code searching, linting, rewriting
- **Homepage:** <https://ast-grep.github.io/>
- **Repository:** <https://github.com/ast-grep/ast-grep>
- **Zuletzt aktualisiert:** 2026-07-23T18:26:12Z
- **Generiert:** 2026-08-03T19:37:03+00:00

## Executables

- ast-grep (Alias)
- sg (Alias)

## Installationsverhalten

- Bottle: nicht verfügbar

## Version und Aktualität

- Seite generiert: 2026-08-03
- Manager-Version: 0.45.0
## Projektgeschichte und Nutzung

ast-grep is a Rust command-line tool for structural code search, linting, and rewriting. It combines a grep-like user experience with tree-sitter-backed abstract syntax tree matching, so patterns are written as code snippets rather than as only text regular expressions.

### Projektgeschichte

The ast-grep repository was created in 2022 and the official docs carry a 2022-present copyright. The README presents the tool as ast-grep or sg, with a core algorithm that searches and rewrites code using tree-sitter-produced ASTs.

The project expanded beyond one-off search into project configuration, YAML lint rules, transformations, rewriters, custom languages, language injections, editor integrations, JavaScript and Python APIs, and a browser playground. The official sgconfig documentation positions sgconfig.yml as the root configuration file for multi-rule scans, similar in role to tsconfig.json or ESLint configuration.

### Adoptionsgeschichte

ast-grep was packaged early across developer ecosystems rather than through a single language channel. The official README lists npm, pip, cargo, cargo-binstall, Homebrew, Scoop, mise, MacPorts, Nix shell, and source builds, while the supplied package facts add Alpine, Arch, winget, zypper, and Nix availability.

The tool gained attention because it serves several audiences with one binary: maintainers doing codemods for breaking changes, teams enforcing project-specific static rules, and security researchers writing structural queries faster than full compiler plugins.

### Wie es verwendet wird

The simplest usage is a command such as ast-grep --pattern ... --rewrite ... --lang ts. Larger projects add sgconfig.yml at the project root, define ruleDirs, and run scan; ast-grep discovers sgconfig.yml by walking up from the working directory, and can also use a home-directory sgconfig.yml for global configuration.

### Warum Paket-Nerds sich dafür interessieren

ast-grep is significant because it occupies the middle ground between grep, semgrep-style structural search, ESLint-style linting, and codemod frameworks. Package maintainers care because it ships as a native Rust CLI but is distributed through npm, pip, cargo, Homebrew, and OS package managers, which makes binary packaging, completions, and config discovery part of the user experience.

### Zeitleiste

- 2022: ast-grep/ast-grep repository created on GitHub.
- 2022-present: Official docs copyright period begins.
- 2020s: README documents installation via npm, pip, cargo, Homebrew, Scoop, mise, MacPorts, Nix shell, and source builds.
- 2026: GitHub metadata showed active development and a large star/fork footprint for a developer-tool CLI.

### Related projects

- tree-sitter supplies the parsing foundation for ast-grep's AST matching.
- ESLint and tsconfig.json are referenced by the docs as familiar configuration analogies.
- semgrep, codemod tools, ripgrep/grep, and language-specific linters occupy adjacent search, rewrite, and policy-enforcement space, though the official sources emphasize ast-grep's code-pattern syntax and tree-sitter core.

### Quellen

- <https://api.github.com/repos/ast-grep/ast-grep>
- <https://ast-grep.github.io/guide/project/project-config.html>
- <https://ast-grep.github.io/reference/sgconfig.html>
- <https://github.com/ast-grep/ast-grep#readme>
- source_facts.package-manager


## Sicherheitshinweise

Für ast-grep wurde kein passendes lokales Secret-Handling-Manifest gefunden. Nucleus-Paketmetadaten bleiben hier veröffentlicht, damit künftige Abdeckung eine stabile Paket-URL hat.



## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ./sgconfig.yml, ~/sgconfig.yml
## Andere Paketmanager-Einträge

- Nix - ast-grep: normalized package name match | nixpkgs package indexes: pkgs/by-name/as/ast-grep/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - ast-grep - 0.28.1-r0: normalized package name match | Alpine Linux edge package indexes: ast-grep from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | A CLI tool for code structural search, lint and rewriting | https://github.com/ast-grep/ast-grep
- apk - ast-grep-bash-completion - 0.28.1-r0: normalized package name match | Alpine Linux edge package indexes: ast-grep-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Bash completions for ast-grep | https://github.com/ast-grep/ast-grep
- apk - ast-grep-fish-completion - 0.28.1-r0: normalized package name match | Alpine Linux edge package indexes: ast-grep-fish-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Fish completions for ast-grep | https://github.com/ast-grep/ast-grep
- apk - ast-grep-zsh-completion - 0.28.1-r0: normalized package name match | Alpine Linux edge package indexes: ast-grep-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Zsh completions for ast-grep | https://github.com/ast-grep/ast-grep
- pacman - ast-grep - 0.44.1-1: normalized package name match | Arch Linux sync databases: ast-grep from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | CLI tool for code structural search, lint and rewriting | https://ast-grep.github.io/
- zypper - ast-grep - 0.45.0-1.2: normalized package name match | openSUSE Tumbleweed package metadata: ast-grep from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | A CLI tool for code structural search, lint and rewriting | https://ast-grep.github.io/
- MacPorts - ast-grep: normalized package name match | MacPorts ports tree: devel/ast-grep/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/ast-grep: normalized package name match | Scoop official bucket manifest trees: bucket/ast-grep.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - ast-grep.ast-grep: normalized package name match | Windows Package Manager source index: ast-grep.ast-grep from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

View the package source record on GitHub. [combined/ast-grep.yml](https://github.com/mxcl/pkgdb/blob/main/combined/ast-grep.yml)


## Quellen

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
