Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

completion-ruby: bash completion for Ruby-related commands

completion-ruby is a set of bash scripts offering command-line completion for various Ruby-related commands and tools.


These scripts depend on some utility functions from bash-completion. It should be part of pretty much any modern Linux distribution, and you can install it on macOS using Homebrew:

brew install bash-completion

Save the completion files somewhere (in the same directory) and add the following line to your ~/.bashrc or ~/.profile:

. /path/to/completion-ruby-all

The completion-ruby-all script loads all the completions it finds, but only for the commands you appear to have installed. Alternatively, you can just save the specific scripts you wish, and source them individually.

Why yet another completion script?

Before writing my own, I'd seen about five different scripts for rake completion. None of them, though, at the same time:

  • cached the task list for fast results;
  • invalidated said cache when the rakefile was modified;
  • worked properly with namespaces; and
  • worked on subdirectories of the project

...among other minor quirks. While providing all of the above, a few other niceties were added, like command-line options completion and awareness of task arguments.

This script is not perfect (for instance, it won't update the cache if a dependency of the rakefile is updated; as a workaround, simply touch Rakefile), but it tries to cover all the most common cases without overcomplicating or overthinking the code.


To ensure the scripts run across a wide range of versions of tools, some automated tests are performed. Please see the tests directory for details.

License and website

Copyright © 2008-2022 Daniel Luz.

completion-ruby is distributed under the MIT license.

The source is available in a Git repository at GitHub.

For up-to-date information, visit this project's permalink.


Command-line completion for Ruby-related commands under Bash: rake, bundle, gem, rails, ruby, jruby








No releases published


No packages published

Contributors 4