🍺 BREW Explorer

← all formulae

cxxopts

brew install cxxopts v3.3.1 MIT

Header-only C++ library for parsing command-line arguments with support for flags, options, and positional arguments.

Why you might care

Use cxxopts when building C++ CLI tools and want a lightweight, self-contained argument parser with no external dependencies. It's header-only, so just include and compile—no linking required. More modern and flexible than getopt or boost::program_options for typical CLI use.

Categories

Alternatives

boost::program_options getopt CLI11 argparse
6.3k
30-day installs · #499
21.0k
90-day · #497
37.2k
365-day · #792
4.8k
★ GitHub stars · updated 7d ago

Build dependencies

GitHub topics

c-plus-plus option-parser positional-arguments

Links

Blurb generated by claude-haiku-4-5 on today.

Raw metadata
{
  "aliases": [],
  "alternatives": [
    "boost::program_options",
    "getopt",
    "CLI11",
    "argparse"
  ],
  "build_dependencies": [
    "cmake"
  ],
  "categories": [
    "library",
    "header-only-library",
    "parser"
  ],
  "caveats": null,
  "conflicts_with": [],
  "dependencies": [],
  "deprecated": 0,
  "deprecation_reason": null,
  "desc": "Lightweight C++ command-line option parser",
  "disable_reason": null,
  "disabled": 0,
  "enrichment_fetched_at": "2026-06-20T23:36:46+00:00",
  "first_seen": "2026-06-20T23:34:18+00:00",
  "full_name": "cxxopts",
  "github_default_branch": "master",
  "github_last_commit_at": "2026-06-13T17:14:13Z",
  "github_readme_excerpt": "\u003cdiv align=\"center\"\u003e\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/jarro2783/cxxopts/cmake.yml?label=build)](https://github.com/jarro2783/cxxopts/actions/workflows/cmake.yml)\n[![Conan](https://img.shields.io/conan/v/cxxopts)](https://conan.io/center/recipes/cxxopts)\n[![vcpkg](https://img.shields.io/vcpkg/v/cxxopts)](https://vcpkg.io/en/package/cxxopts)\n[![GitHub release](https://img.shields.io/github/v/release/jarro2783/cxxopts?label=github%20release)](https://github.com/jarro2783/cxxopts/releases)\n\n[![Header Only](https://img.shields.io/badge/header--only-yes-green.svg)](https://github.com/jarro2783/cxxopts)\n[![Mentioned in Awesome C++](https://awesome.re/mentioned-badge.svg)](https://github.com/fffaraz/awesome-cpp)\n[![Homebrew](https://img.shields.io/homebrew/installs/dy/cxxopts?label=brew%20downloads\u0026logo=homebrew)](https://formulae.brew.sh/formula/cxxopts)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n\n\u003c/div\u003e\n\n# Release versions\n\nNote that `master` is generally a work in progress, and you probably want to use a\ntagged release version.\n\n## Version 3 breaking changes\n\nIf you have used version 2, there are a couple of breaking changes in version 3\nthat you should be aware of. If you are new to `cxxopts` you can skip this\nsection.\n\nThe parser no longer modifies its arguments, so you can pass a const `argc` and\n`argv` and expect them not to be changed.\n\nThe `ParseResult` object no longer depends on the parser. So it can be returned\nfrom a scope outside the parser and still work. Now that the inputs are not\nmodified, `ParseResult` stores a list of the unmatched arguments. These are\nretrieved like follows:\n\n```cpp\nauto result = options.parse(argc, argv);\nresult.unmatched(); // get the unmatched arguments\n```\n\n# Quick start\n\nThis is a lightweight C++ option parser library, supporting the standard GNU\nstyle syntax for options.\n\nOptions can be given as:\n\n    --long\n    --long=argument\n    --long argument\n    -",
  "github_repo": "jarro2783/cxxopts",
  "github_stars": 4779,
  "github_topics": [
    "c-plus-plus",
    "option-parser",
    "positional-arguments"
  ],
  "homepage": "https://github.com/jarro2783/cxxopts",
  "homepage_og_description": null,
  "homepage_og_image": null,
  "homepage_title": null,
  "installs_30d": 6343,
  "installs_365d": 37154,
  "installs_90d": 20972,
  "keg_only": 0,
  "keg_only_reason": null,
  "last_seen": "2026-06-20T23:34:18+00:00",
  "license": "MIT",
  "llm_generated_at": "2026-06-20T23:45:15+00:00",
  "llm_model": "claude-haiku-4-5",
  "name": "cxxopts",
  "oldnames": [],
  "one_liner": "Header-only C++ library for parsing command-line arguments with support for flags, options, and positional arguments.",
  "optional_dependencies": [],
  "rank_30d": 499,
  "rank_365d": 792,
  "rank_90d": 497,
  "raw_hash": "f7392211dcfe4f85",
  "recommended_dependencies": [],
  "revision": 0,
  "ruby_source_path": "Formula/c/cxxopts.rb",
  "tap": "homebrew/core",
  "test_dependencies": [],
  "uses_from_macos": [],
  "version_head": "HEAD",
  "version_stable": "3.3.1",
  "versioned_formulae": [],
  "why_use_this": "Use cxxopts when building C++ CLI tools and want a lightweight, self-contained argument parser with no external dependencies. It\u0027s header-only, so just include and compile\u2014no linking required. More modern and flexible than getopt or boost::program_options for typical CLI use."
}