sh: __docker_machine_ps1: command not found
source: https://github.com/docker/machine/issues/2529
I'm using macOS Sierra v10.12.6.
I added Bash Completion with the following steps thanks for @rubyconvict:
Install Bash Completion scripts. Replace version in URLs below with latest Docker Machine version https://github.com/docker/machine/releases.
Note: If Bash Completion already installed with Homebrew (check with brew list bash-completion) then use /etc/bash_completion.d/ instead of /usr/local/etc/bash_completion.d/ below:
brew install wget
sudo su
cd /usr/local/etc/bash_completion.d/
wget https://raw.githubusercontent.com/docker/machine/v0.12.2/contrib/completion/bash/docker-machine-prompt.bash
wget https://raw.githubusercontent.com/docker/machine/v0.12.2/contrib/completion/bash/docker-machine-wrapper.bash
wget https://raw.githubusercontent.com/docker/machine/v0.12.2/contrib/completion/bash/docker-machine.bash
exit
Append to ~/.bashrc.
echo 'source /usr/local/etc/bash_completion.d/docker-machine-prompt.bash' >> ~/.bashrc;
echo 'source /usr/local/etc/bash_completion.d/docker-machine-wrapper.bash' >> ~/.bashrc;
echo 'source /usr/local/etc/bash_completion.d/docker-machine.bash' >> ~/.bashrc;
echo 'PS1="[\u@\h \W$(__docker_machine_ps1)]\$ "' >> ~/.bashrc;
source ~/.bashrc;
cat ~/.bashrc;