Search

Set up terminal autocomplete on a MacBook

When using the terminal in a Windows environment, we naturally get used to pressing the Tab key for convenient autocomplete.
However, when I tried to use autocomplete on my MacBook, it didn’t work.
After doing some Googling, I found out that on macOS, you need to configure it manually in order to enable this feature.
First, open Terminal on your MacBook and run the following command to move to your home directory:
cd ~
Bash
복사
Then, open the .inputrc file using the vi command
(The .inputrc file controls how commands are entered in the terminal. It defines the behavior of the GNU Readline library, which manages features like Tab autocomplete, case-insensitive matching, and custom key bindings for command editing. The ~/.inputrc file applies settings only to the current user, and it takes precedence over the system-wide configuration in /etc/inputrc.)
vi .inputrc
Bash
복사
Next, add the following lines
set completion-ignore-case on set show-all-if-ambiguous on TAB:menu-complete
Bash
복사
set completion-ignore-case on — Makes autocomplete case-insensitive. For example, typing Do and pressing Tab will match paths like Documents regardless of case.
set show-all-if-ambiguous on — When multiple autocomplete options exist, pressing Tab once will immediately display all candidates instead of requiring two presses.
TAB: menu-complete — Instead of showing all candidates at once, pressing Tab cycles through each option in order (menu-style completion), letting you choose by repeatedly pressing Tab.
Congratulations! You can now enjoy Tab-based autocomplete in your MacBook terminal.