Skip to content
Researched developer tool comparisonsPrices dated · vendor sources linked · no star ratings
Search

Stage 01 · Write · Researched comparison

Best Ruby CLI Libraries in 2026

Thor is the first pick for most teams building a Ruby command-line tool, because it handles commands, options, arguments and generators in one package and is the engine behind Rails generators. Choose dry-cli if you want a small, registry-based framework with no runtime dependencies. Choose OptionParser if you need a zero-dependency parser that ships with Ruby itself.

By
Published 28 Nov 2026 · 6 tools compared

We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.

Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.

Key takeaways

  • Thor, dry-cli, GLI, Commander and Samovar are all open source and free to use; OptionParser ships with Ruby itself.
  • Thor is the most widely used option and suits multi-command tools that need generators and structured options.
  • OptionParser is part of the standard library, so it adds nothing to your Gemfile.
  • None of these libraries sends your code anywhere; they run locally in your Ruby process, so there is no data-sharing concern.

Who each pick is for

  • Multi-command tools and Rails-style generatorsThor
  • Small frameworks with a command registrydry-cli
  • Simple scripts with no extra dependenciesOptionParser
  • Git-style command suites with nested subcommandsGLI
  • Quick single-file command-line toolsCommander
  • Declarative command trees with typed optionsSamovar

Comparison

The 6 tools at a glance
ToolBest forStandout featureListed starting priceFree plan or trial
1ThorMulti-command tools and Rails-style generatorsWidely used and well documentedFree (open source)Free plan
2dry-cliSmall frameworks with a command registryNo runtime dependenciesFree (open source)Free plan
3OptionParserSimple scripts with no extra dependenciesPart of the Ruby standard libraryFreeFree plan
4GLIGit-style command suites with nested subcommandsDesigned for git-like command suitesFree (open source)Free plan
5CommanderQuick single-file command-line toolsSmall and easy to readFree (open source)Free plan
6SamovarDeclarative command trees with typed optionsDeclarative definition of commands and optionsFree (open source)Free plan

How we picked

We compared these libraries on fit for building Ruby command-line tools, supported platforms, license and price, dependency weight, and the main limits of each. Sources are the official project repositories, Ruby standard library documentation and vendor pages. None of these libraries sends your code to a third party; they run locally. Prices and maintenance activity change, so confirm the current state on the project page before you commit.

The tools, one by one

01

Thor

Best for multi-command tools and Rails-style generators

Visit github.com
Thor homepage
Thor homepage, captured Nov 2026

What it is and where it fits

Thor is a toolkit for building command-line interfaces and file generators. You define a class, declare commands with `desc`, and Thor maps arguments, options and subcommands for you. It is the engine behind Rails generators, which is why its conventions will look familiar to many Ruby developers. It runs anywhere Ruby runs, on macOS, Linux and Windows.

The project is open source under the MIT license and is maintained by the Rails organization. It has no paid tier. Its main strength is structure: nested commands, option validation, and generator actions for creating and modifying files. The tradeoff is that Thor assumes a certain shape for your CLI, so a single-purpose script may not need it.

Skip Thor if your tool is one command with a few flags, or if you want to avoid the conventions. For anything with subcommands, it saves a lot of wiring.

Standout: Widely used and well documented

Pricing pointer

Free (open source), as listed by the vendor (Thor website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Widely used and well documented
  • built-in command, option and generator support

Drawbacks

  • Larger surface area than minimal parsers
  • conventions can feel heavy for small scripts

Skip it if this limit matters to you: larger surface area than minimal parsers.

Verdict. A sensible pick for multi-command tools and Rails-style generators.

Alternatives in this guide: dry-cli, OptionParser, GLI

02

dry-cli

Best for small frameworks with a command registry

Visit github.com
dry-cli homepage
dry-cli homepage, captured Nov 2026

What it is and where it fits

dry-cli is a general-purpose command-line interface framework from the dry-rb family. You register commands in a registry, and dry-cli resolves and runs them based on the arguments. It has no runtime dependencies, which keeps your gem footprint small.

The library is open source under the MIT license and runs wherever Ruby runs. It focuses on the command dispatch layer and leaves output formatting and prompts to other tools. Options and arguments are parsed per command.

dry-cli is a good fit if you like the dry-rb style and want explicit registration. It is less batteries-included than Thor, so expect to write more of the plumbing yourself. Skip it if you want generators and file actions out of the box.

Standout: No runtime dependencies

Pricing pointer

Free (open source), as listed by the vendor (dry-cli website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • No runtime dependencies
  • simple registry for registering and resolving commands

Drawbacks

  • Fewer built-in conveniences than Thor
  • smaller ecosystem of examples

Skip it if this limit matters to you: fewer built-in conveniences than Thor.

Verdict. A sensible pick for small frameworks with a command registry.

Alternatives in this guide: Thor, OptionParser, GLI

03

OptionParser

Best for simple scripts with no extra dependencies

Visit docs.ruby-lang.org
OptionParser homepage
OptionParser homepage, captured Nov 2026

What it is and where it fits

OptionParser is the argument parser bundled with Ruby. It handles flags, switches, required and optional arguments, type conversion and help banners. Because it ships with the interpreter, there is nothing to add to your Gemfile.

It is documented in the Ruby standard library docs and is maintained as part of Ruby itself. It runs on every platform Ruby supports. For a single-command script with a handful of flags, it is often all you need, and it avoids a dependency entirely.

The limits are real: OptionParser parses options but does not give you subcommands, a command registry, generators or interactive prompts. For multi-command tools you build dispatch yourself or move to Thor, dry-cli or GLI. Many developers start with OptionParser and switch when the tool grows.

Standout: Part of the Ruby standard library

Pricing pointer

Free, as listed by the vendor (OptionParser website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Part of the Ruby standard library
  • no gem to install or version

Drawbacks

  • No command registry or subcommand framework
  • you write dispatch yourself

Skip it if this limit matters to you: no command registry or subcommand framework.

Verdict. A sensible pick for simple scripts with no extra dependencies.

Alternatives in this guide: Thor, dry-cli, GLI

04

GLI

Best for git-style command suites with nested subcommands

Visit github.com
GLI homepage
GLI homepage, captured Nov 2026

What it is and where it fits

GLI is a command-line framework built for tools that look like git, with a top-level command and nested subcommands. It provides option parsing, help text generation and a structure for splitting commands across files.

The project is open source and hosted on GitHub. It runs on standard Ruby platforms. GLI handles the common case of a suite with several subcommands well, and its help output is generated from your command definitions.

The main caveat is maintenance activity: check the repository's recent commits before adopting it for a long-lived project. If you need a large, actively developed ecosystem, Thor is the safer default. GLI still works well for internal tools where the command structure is stable.

Standout: Designed for git-like command suites

Pricing pointer

Free (open source), as listed by the vendor (GLI website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Designed for git-like command suites
  • built-in help and option parsing per command

Drawbacks

  • Less active than Thor
  • smaller community and fewer recent examples

Skip it if this limit matters to you: less active than Thor.

Verdict. A sensible pick for git-style command suites with nested subcommands.

Alternatives in this guide: Thor, dry-cli, OptionParser

05

Commander

Best for quick single-file command-line tools

Visit github.com
Commander homepage
Commander homepage, captured Nov 2026

What it is and where it fits

Commander is a lightweight library for building command-line tools in Ruby. You define global options and named commands, and Commander handles parsing and dispatch. The API is compact, which makes it easy to read a small CLI in one file.

It is open source and available on GitHub. It runs on standard Ruby platforms. Commander covers the basics well: flags, options with values, command aliases and auto-generated help. It does not aim to match Thor's generator features or dry-cli's registry model.

Choose Commander for small internal tools where you want minimal ceremony. For larger suites with many subcommands, or where you need long-term maintenance guarantees, compare recent commit activity against Thor before committing.

Standout: Small and easy to read

Pricing pointer

Free (open source), as listed by the vendor (Commander website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Small and easy to read
  • global and command options in a compact API

Drawbacks

  • Less feature coverage than Thor
  • limited built-in help customization

Skip it if this limit matters to you: less feature coverage than Thor.

Verdict. A sensible pick for quick single-file command-line tools.

Alternatives in this guide: Thor, dry-cli, OptionParser

06

Samovar

Best for declarative command trees with typed options

Visit github.com
Samovar homepage
Samovar homepage, captured Nov 2026

What it is and where it fits

Samovar is a command-line parser that lets you declare a tree of commands and options, then parse arguments against that definition. It separates the command model from the code that runs, which keeps large CLIs organized.

The project is open source and maintained by Samuel Williams. It runs on standard Ruby platforms. Samovar supports nested commands, typed options and generated usage output. It is a good fit if you prefer a declarative style over class-based DSLs.

The tradeoff is community size: there are fewer examples and third-party write-ups than for Thor or OptionParser. Read the repository README and tests before adopting it. For teams that value explicit command definitions, it is a clean option.

Standout: Declarative definition of commands and options

Pricing pointer

Free (open source), as listed by the vendor (Samovar website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Declarative definition of commands and options
  • clean separation of parsing and execution

Drawbacks

  • Smaller user base
  • fewer tutorials and examples available

Skip it if this limit matters to you: smaller user base.

Verdict. A sensible pick for declarative command trees with typed options.

Alternatives in this guide: Thor, dry-cli, OptionParser

Who should use what

If you are building a multi-command tool with generators, start with Thor. If you want a small framework with no runtime dependencies and a clear command registry, use dry-cli. For a one-off script with a few flags, OptionParser is enough and adds nothing to your Gemfile. Teams building git-style suites should look at GLI, and anyone who prefers declarative command trees should read the Samovar docs.

Questions to settle before you buy

What to check before you buy

  • Confirm the library is still maintained by checking recent commits and releases.
  • Count your subcommands: single-command scripts rarely need a full framework.
  • Check dependency weight, especially for gems shipped to end users.
  • Verify the license matches your project's distribution model.
  • Test help output and error messages on the platforms your users run.

FAQ

Do I need a framework if OptionParser is built in?

No. OptionParser handles flags and arguments for single-command scripts. Move to Thor, dry-cli or GLI when you need subcommands, a command registry or generated help across many commands.

Is Thor only for Rails?

No. Thor is maintained by the Rails organization and powers Rails generators, but it works as a general CLI framework in any Ruby project.

Can I use dry-cli with other output libraries?

Yes. dry-cli focuses on command dispatch, so you can pair it with separate gems for prompts and formatted output while dry-cli handles the command registry.

Are these libraries free?

Yes. Thor, dry-cli, GLI, Commander and Samovar are open source, and OptionParser ships with Ruby. There are no paid tiers for the libraries themselves.

Do these libraries send my data anywhere?

No. They parse arguments and render output inside your Ruby process. Nothing is transmitted to a third party by the library.

Sources we checked

Method: how we score · editorial policy.

  1. Thor (official site)
  2. dry-cli (official site)
  3. OptionParser (official site)
  4. GLI (official site)
  5. Commander (official site)
  6. Samovar (official site)

Change log. First published 28 Nov 2026.