Usually in a Unix/Linux terminal when you press tab it will autocomplete with several options and then it will list the options below for you to select. This is a great feature if you spend a lot of time in the terminal. You could install ZSH to get these features or if you are like me and like to keep things simple, you can enable autocomplete in the mac terminal using bash.
Enable auto-complete in Mac Os terminal
- Type in terminal nano ~/.inputrc
- Paste the following on separate lines
-
set completion-ignore-case on set show-all-if-ambiguous on TAB: menu-complete
- Hit control+O to save changes to .inputrc followed by control+X to exit nano
- Open a new Terminal window or tab to open a new session with autocomplete enabled
- Type and hit the tab key
Let me know if this is helpful in the comments below!
Thanks for reading. Make sure you follow me on Twitter to stay up to date on the progress of my side projects T.LY, Weather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.
$ brew install zsh
Was that even hard?
Now if you’re really tired of seventies tech you should try fish.
Thanks for sharing. Zsh is a good option. This is more for people who don’t want zsh or fish.
Quite right too. Very helpful – thanks!
Hey, that’s super not-helpful! I like bash. So do tons of other people.
i dislike fish its not available everywhere. Agree ZSH is a good option. though bash serves me well.
I also prefer bash. In most cases I like to keep things stock. Thanks for checking out the article 👍
Thanks for the post! 😀
Awesome tip, been slightly annoyed by case-sensitive auto complete but never thought to look up a work around!
Thanks!!!
.inputrc is a bash thing, it has nothing to do with the Mac Terminal as the headline says.
If you’re not using bash, this won’t help.
If you are using bash and using iterm2 or some other terminal program or ssh’ing, it will.
Good point but isn’t bash default for Mac OS? I’m assuming that if you are not using bash, you would know this Wil not work. Thanks for the feedback. I will update the post 👍
It’s good Tim put Mac in the post as a novice like me search it as a mac terminal issue.
Thanks a lot, Tim, My content is that such simple solutions make you a pro.
Thanks! Glad it helped
Here is also autocompletion tool for tmux, works in mac too: https://tmux.reconquest.io/
Thanks for sharing!
Fish FTW. Used it on linux and mac!
I’ve heard of fish. Looks neat! Thanks for sharing.
I second the notion of using bash. I think the information here could be a good starting point for many macOS users.
Cheers Tim!
👍
Thanks for the Article, really saved me time 🙂
Great glad it helped!
works like a charm ! thank you !
Great!
Great tip, I like using stock features and not adding adding things just because…
Yes I agree!!
Super useful! Thank you very much for a simple explanation.
No problem! Glad it helped.
Life saver Tim. Thank you. Always miss that when I move between my linux box and Mac 🙂
No problem! Glad it helped.
Super helpful – thanks!
Hello, I am new to terminal and pretty green to coding in general. If for some reason I wanted to remove this setting after having installed it, is there an easier way than to reset my terminal and manually putting in my preferred settings from scratch?
Thanks for your time
Hey Ian,
Yes you should be able to remove the lines and save the file. Once you open a new terminal it will be back to how it was before.
haha thanks for the speedy response Tim! I guess as such a new guy… how to I access the lines that I just added and remove them?
Very Nice, that works! Thanks.
A combination of this and https://unix.stackexchange.com/questions/391637/osx-bash-terminal-auto-completion-odd-behavior-on-double-tab gave me what I needed. Thanks so much!
Awesome!
Hey Tim,
Your instructions seem to be consistent with other posts. I have entered those three lines in the .input.rc file. However, autocomplete still doesn’t work. Any ideas?
I’m just referring to the default terminal program in macOS.
Thanks,
Vernon
Hey Vernon,
Did you close the terminal and reopen it?
Yes, I had closed terminal app and opened again.
Hmm make sure. Try editing inputrc file and make sure you see it set correctly.
Hi. Absolutely sure. tried a few times.
Thanks for the article.
And that is a big thanks from one who likes bash and even uses vi for the last 35 years .
Great thanks!