# Install stylua with Homebrew, apk, MacPorts, Nix, pacman, scoop, winget, zypper

Opinionated Lua code formatter. Version 2.5.2 via Homebrew; verified 2026-05-16. Also installable with nix: nix profile install nixpkgs#stylua.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install stylua
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install stylua
```

  Evidence: 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
```

  Evidence: 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
```

  Evidence: 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
```

  Evidence: 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
```

  Evidence: 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
```

  Evidence: 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
```

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

## Package facts

- **Package key:** brew:stylua
- **Package manager:** Homebrew
- **Version:** 2.5.2
- **Source summary:** Opinionated Lua code formatter
- **Homepage:** <https://github.com/JohnnyMorganz/StyLua>
- **Repository:** <https://github.com/JohnnyMorganz/StyLua>
- **Last updated:** 2026-05-16T18:32:04Z
- **Generated:** 2026-08-03T19:37:03+00:00

## Executables

- stylua (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 2.5.2
## Project history and usage

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.

### Project history

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.

### Adoption history

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.

### How it is used

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.

### Why package nerds care

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.

### Timeline

- 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.

### Sources

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


## Security Notes

No matching local secret-handling manifest was found for stylua. Nucleus package metadata is still published here so future coverage has a stable package 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
## Other Package-Manager Records

- 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


## Combined YAML source

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


## Sources

- 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
