# 使用 Homebrew, apk, dnf, MacPorts, Nix, pacman, zypper, apt 安装 gflags

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

## 安装

```sh
sudo av install brew:gflags
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install gflags
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install gflags
```

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

### Linux

- apk (92%):

```sh
sudo apk add gflags
```

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

- dnf (92%):

```sh
sudo dnf install gflags
```

  证据: Fedora Rawhide package metadata: gflags from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#gflags
```

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

- pacman (92%):

```sh
sudo pacman -S gflags
```

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

- zypper (92%):

```sh
sudo zypper install gflags
```

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

- Debian apt (92%):

```sh
sudo apt install libgflags-dev
```

  证据: Debian stable package indexes: libgflags-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

## 软件包事实

- **软件包键:** brew:gflags
- **软件包管理器:** Homebrew
- **版本:** 2.3.1
- **来源摘要:** Library for processing command-line flags
- **主页:** <https://gflags.github.io/gflags/>
- **仓库:** <https://github.com/gflags/gflags>
- **最后更新:** 2026-07-22T19:39:32Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- gflags_completions.sh (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 2.3.1
## 项目历史与用法

gflags is the open-source C++ command-line flags library that began as Google Commandline Flags. Its distinguishing design is that flag definitions can live in the source file that uses them, with the library collecting, parsing, validating, and documenting those flags for an executable.

### 项目历史

The changelog records a Google Inc. 0.1 release in December 2006, followed by 1.0 in October 2008 and several google-gflags releases through 2011. In January 2012, the project was renamed from google-gflags to gflags as Google stepped back from ownership and Andreas Schuh became maintainer.

### 采用历史

gflags spread through C++ infrastructure because it offered a Google-style alternative to getopt-like parsers: each library or translation unit could declare its own flags, while users still received unified help output and parsing behavior. Later releases emphasized package and build-system integration, including CMake, Bazel, pkg-config, Homebrew, Debian/Ubuntu packages, and vcpkg.

### 使用方式

Practitioners add `DEFINE_*` and `DECLARE_*` macros in C++ code, link the library, call the parser during program startup, and then read `FLAGS_name` variables from the relevant code. The installation docs cover use through distro packages, Homebrew, Bazel, vcpkg, and CMake.

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

gflags matters to package maintainers because it is both a runtime library and a build-system integration target for many C++ projects. The long namespace transition from `google` to `gflags`, plus compatibility for projects such as glog, made ABI and include-path behavior unusually important.

### 时间线

- 2006: Google Inc. released google-gflags 0.1.
- 2008: google-gflags 1.0 was released.
- 2012: google-gflags was renamed to gflags and community ownership began.
- 2014: Version 2.1 switched the build configuration to CMake and changed the default namespace to `gflags`.
- 2015: Version 2.1.2 completed the move from Google Code to GitHub.
- 2025: Version 2.3.0 added maintenance fixes for Bazel, CMake, QNX, and option processing.

### Related projects

- The README points Abseil users to Abseil Flags, noting that an internal fork of the library was re-released as part of Abseil. The gflags organization also includes python-gflags history, which moved to Google's Python repository and later to Abseil Python guidance.

### 来源

- <https://gflags.github.io/gflags/>
- <https://github.com/gflags/gflags>
- <https://github.com/gflags/gflags/blob/main/INSTALL.md>
- <https://raw.githubusercontent.com/gflags/gflags/main/ChangeLog.txt>
- <https://raw.githubusercontent.com/gflags/gflags/main/README.md>


## 安全说明

library-like package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- library-like package without higher-risk signals

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

- Debian apt - libgflags-dev - 2.2.2-2: normalized package name match | Debian stable package indexes: libgflags-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | commandline flags module for C++ (development files) | https://gflags.github.io/gflags/
- Debian apt - libgflags-doc - 2.2.2-2: normalized package name match | Debian stable package indexes: libgflags-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | documentation of gflags | https://gflags.github.io/gflags/
- Debian apt - libgflags2.2 - 2.2.2-2: normalized package name match | Debian stable package indexes: libgflags2.2 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | commandline flags module for C++ (shared library) | https://gflags.github.io/gflags/
- Nix - gflags: normalized package name match | nixpkgs package indexes: pkgs/by-name/gf/gflags/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - libgflags-dev - 2.2.2-2build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libgflags-dev from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | commandline flags module for C++ (development files) | https://gflags.github.io/gflags/
- Ubuntu apt - libgflags-doc - 2.2.2-2build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libgflags-doc from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | documentation of gflags | https://gflags.github.io/gflags/
- Ubuntu apt - libgflags2.2 - 2.2.2-2build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libgflags2.2 from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | commandline flags module for C++ (shared library) | https://gflags.github.io/gflags/
- apk - gflags - 2.3.0-r0: normalized package name match | Alpine Linux edge package indexes: gflags from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | The gflags package contains a C++ library that implements commandline flags processing. | https://gflags.github.io/gflags/
- apk - gflags-dev - 2.3.0-r0: normalized package name match | Alpine Linux edge package indexes: gflags-dev from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | The gflags package contains a C++ library that implements commandline flags processing. (development files) | https://gflags.github.io/gflags/
- dnf - gflags - 2.2.2-21.fc45: normalized package name match | Fedora Rawhide package metadata: gflags from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Library for commandline flag processing | https://gflags.github.io/gflags/
- dnf - gflags-devel - 2.2.2-21.fc45: normalized package name match | Fedora Rawhide package metadata: gflags-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Development files for gflags | https://gflags.github.io/gflags/
- pacman - gflags - 2.2.2-6: normalized package name match | Arch Linux sync databases: gflags from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | C++ Library for commandline flag processing | https://github.com/schuhschuh/gflags
- zypper - gflags - 2.2.2-4.7: normalized package name match | openSUSE Tumbleweed package metadata: gflags from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Library for commandline flag processing | https://github.com/gflags/gflags
- zypper - gflags-devel - 2.2.2-4.7: normalized package name match | openSUSE Tumbleweed package metadata: gflags-devel from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Development files for the dynamic gflags library | https://github.com/gflags/gflags
- zypper - libgflags2_2 - 2.2.2-4.7: normalized package name match | openSUSE Tumbleweed package metadata: libgflags2_2 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Library for commandline flag processing | https://github.com/gflags/gflags
- MacPorts - gflags: normalized package name match | MacPorts ports tree: devel/gflags/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

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


## 来源

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