This is what I did in macOS to switch the shell shell from zsh
to bash
, restoring Homebrew paths, and enabling Colima command-line completion.
First, check your current shell:
echo $SHELL
If it still shows /bin/zsh
, change it:
Using the system bash:
chsh -s /bin/bash
Or using Homebrew’s newer bash (recommended):
brew install bash
sudo bash -c 'echo /opt/homebrew/bin/bash >> /etc/shells'
chsh -s /opt/homebrew/bin/bash
Then restart Terminal.
Create or update your ~/.bash_profile
with items from .zshrc. There may be some zsh specific commands that you'll need to account for
Homebrew wasn't setup in my bash environment so I had to add it:
Apple Silicon:
# Add to ~/.bash_profile or ~/.bashrc
eval "$(/opt/homebrew/bin/brew shellenv)"
Intel Macs:
# Add to ~/.bash_profile or ~/.bashrc
eval "$(/usr/local/bin/brew shellenv)"
Reload:
source ~/.bash_profile
Verify:
which brew
Install bash completion:
brew install bash-completion@2
Then add to your ~/.bash_profile or ~/.bashrc:
# Enable Homebrew bash-completion
[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && \
source "/opt/homebrew/etc/profile.d/bash_completion.sh"
For Intel Macs, replace /opt/homebrew
with /usr/local
.
Generate Colima’s bash completion script:
colima completion bash > ~/.colima_complete
Then add to your ~/.bashrc
:
# Colima CLI completion
if [ -f "$HOME/.colima_complete" ]; then
source "$HOME/.colima_complete"
fi
Reload the shell:
source ~/.bashrc
Now try:
colima [TAB][TAB]