# 使用 Homebrew, apk, MacPorts, Nix, pacman, scoop, winget, zypper 安装 stylua

查看 stylua 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:stylua
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install stylua
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install stylua
```

  证据: MacPorts ports tree: lua/stylua/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add stylua
```

  证据: Alpine Linux edge package indexes: stylua from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Nix (92%):

```sh
nix profile install nixpkgs#stylua
```

  证据: nixpkgs package indexes: pkgs/by-name/st/stylua/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S stylua
```

  证据: Arch Linux sync databases: stylua from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install StyLua
```

  证据: openSUSE Tumbleweed package metadata: StyLua from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/stylua
```

  证据: Scoop official bucket manifest trees: bucket/stylua.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id JohnnyMorganz.StyLua -e
```

  证据: Windows Package Manager source index: JohnnyMorganz.StyLua from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:stylua
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/stylua>
- **版本:** 2.5.2
- **来源摘要:** Opinionated Lua code formatter
- **主页:** <https://github.com/JohnnyMorganz/StyLua>
- **仓库:** <https://github.com/JohnnyMorganz/StyLua>
- **许可证:** MPL-2.0
- **源码归档:** <https://github.com/JohnnyMorganz/StyLua/archive/refs/tags/v2.5.2.tar.gz>
- **最后更新:** 2026-05-16T18:32:04Z
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- stylua (cli)
- stylua (别名)

## 构建依赖

- rust

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 2.5.2
- 管理器更新时间: 2026-05-16
- 本地数据: OK
- 上游仓库: https://github.com/JohnnyMorganz/StyLua
- 检测到的最新版本: v2.5.2 (当前)
## 项目历史与用法

StyLua is a deterministic Lua-family code formatter. Its README says it formats Lua 5.1 through 5.4, LuaJIT, Luau, and CfxLua/FiveM Lua by parsing code and printing it back out with a consistent style inspired by Prettier.

### 项目历史

The official changelog begins with version 0.1.0 on 2020-12-30, adding CLI stdin support and formatting behavior for expanded tables. The project later grew from a Lua formatter into a multi-runtime tool with runtime syntax selection, language-server mode, prebuilt binaries, npm wrappers, Docker images, pre-commit hooks, and editor integrations.

### 采用历史

The README documents installation through GitHub Releases, Cargo/crates.io, GitHub Actions, pre-commit, npm, Docker, Homebrew, pip/uv from Git, VS Code, Aftman, and community package repositories. The input package-manager facts also show packaging across APK, Homebrew, MacPorts, Nix, Pacman, Scoop, and zypper.

### 使用方式

The usual workflow is `stylua` over files or directories, with `--check` in CI, stdin support for editors, `.styluaignore` for filtering, and `stylua.toml` or `.stylua.toml` for project configuration. The README recommends a project-root `.stylua.toml` so teams share the same formatting behavior.

### 为什么软件包爱好者会关心

StyLua is interesting to package nerds because it crosses ecosystems: Rust crate, standalone GitHub binary, npm binary wrapper, Docker image, Homebrew formula, pre-commit hook, and editor formatter. Its 2.x history includes packaging details such as platform-specific npm optional packages and changed release artifact names, both of which directly affect downstream packaging.

### 时间线

- 2020-12-30: StyLua 0.1.0 released with CLI stdin support.
- 2024-11-17: StyLua 2.0.0 changed release artifact names and added runtime syntax configuration.
- 2025-09-14: StyLua 2.2.0 added language server mode.
- 2026-05-16: StyLua 2.5.0 changed npm binary packaging to platform-specific optional packages.

### Related projects

- The README names full-moon as the parser foundation and Prettier as an inspiration, while also tying StyLua to Luau, Roblox style conventions, CfxLua/FiveM, pre-commit, GitHub Actions, Docker, npm, Cargo, Aftman, VS Code, Neovim, Sublime, and Zed.

### 来源

- <https://raw.githubusercontent.com/JohnnyMorganz/StyLua/main/CHANGELOG.md>
- <https://raw.githubusercontent.com/JohnnyMorganz/StyLua/main/README.md>
- input source_facts.package-manager


## 安全说明

没有找到 stylua 的匹配本地密钥处理 manifest。软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。



## 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: stylua.toml, .stylua.toml, $XDG_CONFIG_HOME/stylua, ~/.config/stylua
- Windows: stylua.toml, .stylua.toml
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** stylua
- **Version Scheme:** 0
- **Revision:** 0
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

## 其他软件包管理器记录

- Nix - stylua: normalized package name match | nixpkgs package indexes: pkgs/by-name/st/stylua/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - stylua - 2.5.2-r0: normalized package name match | Alpine Linux edge package indexes: stylua from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Opinionated Lua code formatter | https://github.com/JohnnyMorganz/StyLua
- pacman - stylua - 2.5.2-1: normalized package name match | Arch Linux sync databases: stylua from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Deterministic code formatter for Lua | https://github.com/JohnnyMorganz/StyLua
- zypper - StyLua - 2.0.2-1.7: normalized package name match | openSUSE Tumbleweed package metadata: StyLua from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Opinionated Lua code formatter | https://github.com/JohnnyMorganz/StyLua
- MacPorts - stylua: normalized package name match | MacPorts ports tree: lua/stylua/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/stylua: normalized package name match | Scoop official bucket manifest trees: bucket/stylua.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - JohnnyMorganz.StyLua: normalized package name match | Windows Package Manager source index: JohnnyMorganz.StyLua from https://cdn.winget.microsoft.com/cache/source.msix


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [rust](https://pkg.so/zh-hans/brew/rust/) - Build dependency declared by Homebrew.
- [swiftformat](https://pkg.so/zh-hans/brew/swiftformat/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [black](https://pkg.so/zh-hans/brew/black/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [gofumpt](https://pkg.so/zh-hans/brew/gofumpt/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [ktfmt](https://pkg.so/zh-hans/brew/ktfmt/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [gnu-indent](https://pkg.so/zh-hans/brew/gnu-indent/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [yapf](https://pkg.so/zh-hans/brew/yapf/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [snakefmt](https://pkg.so/zh-hans/brew/snakefmt/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [gci](https://pkg.so/zh-hans/brew/gci/) - Shares pkgdb curated category or tags: cli, code-style, developer-tools, formatter.
- [cljfmt](https://pkg.so/zh-hans/brew/cljfmt/) - Local package facts share a topical domain. Shared terms: cli, code, code-style, developer, developer-tools.
- [erlfmt](https://pkg.so/zh-hans/brew/erlfmt/) - Local package facts share a topical domain. Shared terms: cli, code, code-style, developer, developer-tools.

## Combined YAML source

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


## 来源

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