Bourne Again SHell (Bash) is the GNU Project's shell.
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh).
The standard macOS Terminal appearance is just boring. Apple included a few nice preset themes too, but to really make your terminal appearance stand out you need to customize it yourself.
Below is the Terminal using my personal theme and .bash_profile
configuration. Feel free to copy and use it.
-
Open the macOS Terminal
-
In the top menu bar, select
Terminal
thenPreferences...
(⌘,) -
Select the
Profiles
tab -
Choose the Basic or Pro profile/theme from the left side list
-
Press the
Default
button near the bottom of the window -
Under the
Text
tab check the boxes:Antialias text
Use bold fonts
Display ANSI colors
Use bright colors for bold text
You can update and set up Bash following this tutorial or using the mac-setup install script:
bash <(curl -fsSL raw.githubusercontent.com/monsieurborges/mac-setup/master/install) bash
If you decide to do it on your own:
-
Define HOMEBREW_PREFIX
if [[ "$(/usr/bin/uname -m)" == "arm64" ]]; then HOMEBREW_PREFIX="/opt/homebrew" else HOMEBREW_PREFIX="/usr/local" fi eval "$(${HOMEBREW_PREFIX}/bin/brew shellenv)"
-
Update bash:
brew install bash
-
Add the new shell to the list of allowed shells:
if $(grep -Fxq "${HOMEBREW_PREFIX}/bin/bash" /etc/shells); then echo "The list of shells is already updated" else sudo echo "${HOMEBREW_PREFIX}/bin/bash" >> /etc/shells fi
-
Change to the new shell:
chsh -s "${HOMEBREW_PREFIX}/bin/bash"
-
Check the bash version:
bash --version
Follow the tutorial or just paste that on the Terminal:
bash <(curl -fsSL raw.githubusercontent.com/monsieurborges/mac-setup/master/install) bashconfig
Paste that in the terminal:
read -r -d '' INPUTRC <<"EOF"
"\e[A":history-search-backward
"\e[B":history-search-forward
set colored-stats on
set mark-symlinked-directories on
set show-all-if-ambiguous on
set show-all-if-unmodified on
set visible-stats on
set completion-ignore-case on
TAB: menu-complete
EOF
echo "${INPUTRC}" > "${HOME}/.inputrc"
-
Backup the current
.bash_profile
file:if [[ -f "${HOME}/.bash_profile" ]]; then cp "${HOME}/.bash_profile" "${HOME}/.bash_profile.bkp" fi
-
Update the
.bash_profile
. Paste that in the terminal:read -r -d '' BASH_PROFILE <<"EOF" #!/bin/bash # Bash Profile for macOS # Copyright (c) Monsieur Borges # https://github.com/monsieurborges/mac-setup # LS Colors # CLICOLOR use ANSI color sequences to distinguish file types export CLICOLOR=true export LSCOLORS=gxegbxdxcxahadabafacge alias ls='ls -GFh' # Bash Colors and formatting CYAN="\[\e[38;5;6m\]" MAGENTA="\[\e[38;5;13m\e[1m\]" SKYBLUE="\[\e[38;5;25m\e[1m\]" NONE="\[\e[0m\e[21m\]" # Prevent Mac OS ._ in in tar.gz files export COPYFILE_DISABLE=true # Homebrew if [[ "$(/usr/bin/uname -m)" == "arm64" ]]; then # ARM macOS HOMEBREW_PREFIX="/opt/homebrew" else # Intel macOS HOMEBREW_PREFIX="/usr/local" fi eval "$(${HOMEBREW_PREFIX}/bin/brew shellenv)" # Homebrew completion if [[ -f "$(brew --prefix)/etc/bash_completion.d/brew" ]]; then source "$(brew --prefix)/etc/bash_completion.d/brew" fi # Bash completion@2 if [[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]]; then source "$(brew --prefix)/etc/profile.d/bash_completion.sh" fi # Bash-Git-prompt if [[ -f "$(brew --prefix)/etc/bash_completion.d/git-prompt.sh" ]]; then GIT_PS1_SHOWCOLORHINTS=true GIT_PS1_SHOWDIRTYSTATE=true GIT_PS1_SHOWUNTRACKEDFILES=true GIT_PS1_DESCRIBE_STYLE='default' source "$(brew --prefix)/etc/bash_completion.d/git-prompt.sh" fi # exa is a replacement for ls https://github.com/ogham/exa if command -v exa 1>/dev/null 2>&1; then alias ls="exa --group-directories-first --classify" fi # Python virtual environment # Allow pip only for active virtual environment # Use 'gpip' for global environment export PIP_REQUIRE_VIRTUALENV=true gpip(){ PIP_REQUIRE_VIRTUALENV="" pip "${@}" } # Pyenv Python version management if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" pyenv virtualenvwrapper fi # PRIMARY PROMPT PROMPT_COMMAND='__git_ps1\ "\n${MAGENTA}[\d \t] ${SKYBLUE}$(python --version 2>&1)${NONE}\ \n\u@\h: ${CYAN}\w${NONE}"\ "\n${VIRTUAL_ENV:+($(basename ${VIRTUAL_ENV}))}\\$ "\ " (%s)"' EOF echo "${BASH_PROFILE}" > "${HOME}/.bash_profile"
bash-completion is a collection of command line command completions for the Bash shell.
brew install bash-completion@2
brew install docker-completion docker-machine-completion docker-compose-completion
exa is a replacement for ls written in Rust.
brew install exa