☰ Menu
Home›Command-line Tools›bash-completion@2
CLI Open source 972 installs/mo

bash-completion@2 for Mac

bash-completion@2

bash-completion is a collection of

bash-completion@2 — overview

bash-completion

Introduction

bash-completion is a collection of

recipes for a number of commands for the completion system of the Bash shell. These recipes enhance Bash's typical plain completion of filenames to provide better suggestions of options and arguments for many commands. Also provided is a collection of helper functions to assist in creating new recipes, and a set of facilities for loading recipes automatically on demand, as well as installing them.

Installation

The easiest way to install this software is to use a package; refer to Repology for a comprehensive list of operating system distributions, package names, and available versions.

Depending on the package, you may still need to source it from either /etc/bashrc or ~/.bashrc (or any other file sourcing those). If you have _only_ bash >= 4.2 installed, you can do this by using:

If you have older bash versions in use, their loading of bash_completion should be prevented. See further for more info.

If you don't have the package readily available for your distribution, or you simply don't want to use one, you can install bash-completion using the standard commands for GNU autotools packages:

These commands install the completions and helpers, as well as a profile.d script that loads bash_completion where appropriate.

If your system does not use the profile.d directory (usually below /etc) mechanism (i.e., does not automatically source shell scripts in it), you can source the $sysconfdir/profile.d/bash_completion.sh script in /etc/bashrc or ~/.bashrc.

The profile.d script provides a configuration file hook that can be used to prevent loading bash_completion on a per user basis when it's installed system wide. To do this: Turn off programmable completion with shopt -u progcomp in $XDG_CONFIG_HOME/bash_completion (or ~/.config/bash_completion if $XDG_CONFIG_HOME is not set) Turn it back on (for example in ~/.bashrc) if you want to use programmable completion for other purposes.

macOS (OS X)

If you're using macOS (formerly OS X), /etc/bashrc is apparently not sourced at all, and ~/.bashrc is not sourced from ~/.bash_profile by default (because ~/.bash_profile is not created by default). In this case, the standard way is to configure ~/.bash_profile to source ~/.bashrc and write interactive settings in ~/.bashrc. You can source ~/.bashrc in ~/.bash_profile in the following way:

Then, you can source bash-completion in your ~/.bashrc. It should be noted that bash-completion should not be sourced in ~/.bash_profile because ~/.bash_profile is only loaded in interactive _login_ shell sessions. If you start nested Bash sessions, the interactive settings in ~/.bash_profile will disappear. It is strongly recommended to source ~/.bashrc from ~/.bash_profile and write interactive settings in ~/.bashrc.

Details

适用于 Bash 4.2 的可编程补全

How to install bash-completion@2

  1. Open Terminal (press ⌘ + Space and type “Terminal”).
  2. If Homebrew is not installed yet, run the command below first.
  3. Run this command:

Latest 10 releases

Last updated 2026-07-05; current version 2.18.0, with the latest 10 releases listed.

VersionReleasedTypeSizemacOSWindowsLinux
2.18.02026-07-05Stable480 KBDownload——
2.17.02025-10-31Stable472 KB———
2.16.02024-12-25Stable454 KB———
2.15.02024-11-24Stable447 KB———
2.14.02024-05-09Stable419 KB———
2.13.02024-04-04Stable415 KB———
2.12.02024-02-21Stable407 KB———
2.112020-07-25Stable304 KB———
2.102019-12-05Stable303 KB———
2.92019-04-27Stable299 KB———

Data from GitHub Releases; stable releases first, each group sorted newest first.

Compared with similar apps

Only public metadata is compared, with no subjective recommendation; see the compare pages for field-by-field comparisons.

Compared with similar apps
AppVersionLicenseArchitecture30-day installs
bash-completion@22.18.0GPL-2.0-or-laterCLI972
bash-language-servervscode-client-1.43.2MITCLI667
bash-completion1.3GPL-2.0-or-laterCLI395
openssl@4openssl-4.1.0Apache-2.0CLI494,798

Similar apps: Command-line Tools

Leave a comment

评论表单加载中…