Operating System

Install Rosetta

1
/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Install Xcode

1
xcode-select --install

Package Manager

Install Homebrew

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add Homebrew to your PATH -> /Users/<user home>/.zprofile

1
2
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)

(OPTIONAL) Update/upgrade Homebrew

1
brew update && brew upgrade

Terminal and Mods

Install iterm2

1
brew install --cask iterm2

WARNING: After this step close the default term and open iterm2

Install Oh My Zsh

1
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

(OPTIONAL) Update Oh My Zsh

1
omz update

Install Oh My Zsh useful plugins

List available plugins on your local installation

1
ls ~/.oh-my-zsh/plugins

Configure my plugins

NOTE: my useful plugins list is in the MY_PLUGINS_LIST env var, so check it for yours

1
2
3
4
# check it to add or remove yours
export MY_PLUGINS_LIST="git aws golang zsh-navigation-tools brew docker docker-compose minikube kubectl ansible virtualenv python rust terraform vscode podman"

sed -i"bkup" "s/plugins\=(git)/plugins\=($MY_PLUGINS_LIST)/" ~/.zshrc

Install and configure Custom Plugins

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i"bkup" '/plugins\=/ s/)$/ zsh-syntax-highlighting)/' ~/.zshrc

# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i"bkup" '/plugins\=/ s/)$/ zsh-autosuggestions)/' ~/.zshrc

# zsh-completions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
sed -i"bkup" '/plugins\=/ s/)$/ zsh-completions)/' ~/.zshrc

(OPTIONAL) Configure and install Powerlevel10k Theme for Zsh

Install Powerlevel10 on Oh My Zsh

1
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

(OPTIONAL) Update Powerlevel10k

1
git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull

Configure Oh My Zsh to use Powelevel10k

1
sed -i"bkup" 's/ZSH_THEME\=\"robbyrussell\"/ZSH_THEME\=\"powerlevel10k\/powerlevel10k\"/' ~/.zshrc

(OPTIONAL) Configure Powelevel10k to show only the last directory

1
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last

WARNING:

  • After this step close the iterm2 console
  • Once the iterm2 opens, the process of customization starts, and then closes the iterm2 again to begin the process of configuration of Powerlevel10k

Configure Zsh history

Add history configuration to file ~/.zshrc appending it

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
cat >> ~/.zshrc <<_EOL_
# History
HISTFILE="\$HOME/.zsh_history"
HISTSIZE=500000
SAVEHIST=500000
setopt BANG_HIST                 # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY          # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY        # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY             # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST    # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS          # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS      # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS         # Do not display a line previously found.
setopt HIST_IGNORE_SPACE         # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS         # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS        # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY               # Don't execute immediately upon history expansion.
setopt HIST_BEEP                 # Beep when accessing nonexistent history.
# End of History
_EOL_

Apply changes

1
source ~/.zshrc

IDE and Plugins

Install Visual Studio Code

Using brew cask

1
brew install --cask visual-studio-code

Add vscode to the PATH

useful to call vscode from anywhere

1
2
3
4
cat << EOF >> ~/.zprofile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
EOF

Reload the terminal

1
source ~/.zprofile

Install my default extensions

1
2
3
4
code --install-extension eamodio.gitlens
code --install-extension streetsidesoftware.code-spell-checker
code --install-extension yzhang.markdown-all-in-one
code --install-extension redhat.vscode-yaml

Container Management

Install Podman

Like docker but better because this is free and open source.

Using brew cask

1
brew install podman

Install podman-desktop

1
brew install podman-desktop

Initialize podman machine

This is the container we have in macos to use podman like docker does.

1
podman machine init

NOTE: good reference here https://docs.podman.io/en/latest/markdown/podman-machine-init.1.html

Start podman machine

1
podman machine start

NOTE:

(OPTIONAL) Create a docker alias to podman

This is in case you don’t have installed docker and you want to use podman as a wrapper of this:

1
2
3
4
5
cat << EOF >> ~/.zshrc
# docker alias to podman
# remove it if you want to install docker
alias docker=podman
EOF