After typing sudo I can no longer autocomplete commands by pressing Tab
Solution 1:
OS X has not turned ON as many completion possibilities at the guys behind Ubuntu. In order to add autocompletion to sudo, you should simply add to the file $HOME/.bash_profile
complete -cf sudo
The description of complete
and its options is briefly defined in the bash
built-in commands manual page (see man bash
). Although the -c and -f commands are not obviously detailed, one can find their description under the "-A action" explanation.
Solution 2:
I did fix my problem by installing Bash Completion on Macports.
Solution 3:
It would help to know what shell you are using. This works for me in both bash and zsh. The completion in zsh is much better than bash.
One thing you could do is to type the command you want using tab completion, but before hitting return type control-a
to go to the beginning of the line and then type sudo
and hit return to execute the command.