bash-completion@2 for Mac
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
- Open Terminal (press ⌘ + Space and type “Terminal”).
- If Homebrew is not installed yet, run the command below first.
- Run this command:
Latest 10 releases
Last updated 2026-07-05; current version 2.18.0, with the latest 10 releases listed.
| Version | Released | Type | Size | macOS | Windows | Linux |
|---|---|---|---|---|---|---|
| 2.18.0 | 2026-07-05 | Stable | 480 KB | Download | — | — |
| 2.17.0 | 2025-10-31 | Stable | 472 KB | — | — | — |
| 2.16.0 | 2024-12-25 | Stable | 454 KB | — | — | — |
| 2.15.0 | 2024-11-24 | Stable | 447 KB | — | — | — |
| 2.14.0 | 2024-05-09 | Stable | 419 KB | — | — | — |
| 2.13.0 | 2024-04-04 | Stable | 415 KB | — | — | — |
| 2.12.0 | 2024-02-21 | Stable | 407 KB | — | — | — |
| 2.11 | 2020-07-25 | Stable | 304 KB | — | — | — |
| 2.10 | 2019-12-05 | Stable | 303 KB | — | — | — |
| 2.9 | 2019-04-27 | Stable | 299 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.
| App | Version | License | Architecture | 30-day installs |
|---|---|---|---|---|
| bash-completion@2 | 2.18.0 | GPL-2.0-or-later | CLI | 972 |
| bash-language-server | vscode-client-1.43.2 | MIT | CLI | 667 |
| bash-completion | 1.3 | GPL-2.0-or-later | CLI | 395 |
| openssl@4 | openssl-4.1.0 | Apache-2.0 | CLI | 494,798 |
Similar apps: Command-line Tools
bash-language-server
Bash language server that brings an IDE-like experience for bash scripts to most editors.bash-completion
bash-completion is a set of tools that provides programmable completion for Bash, making…openssl@4
Cryptography and SSL/TLS Toolkitxz
General-purpose data compression with high compression ratiopkgconf
pkgconf is a program which helps to configure compiler and linker flags for development…node
Node.js is an open-source, cross-platform JavaScript runtime environment.Categories: Command-line Tools