Skip to content

Instantly share code, notes, and snippets.

@HarshadRanganathan
Last active June 5, 2024 00:13
Show Gist options
  • Save HarshadRanganathan/16f86a62f382c12a6145f5eab95bc9b7 to your computer and use it in GitHub Desktop.
Save HarshadRanganathan/16f86a62f382c12a6145f5eab95bc9b7 to your computer and use it in GitHub Desktop.
Mac Installs for Developers

Table of Contents

Upgrade Iterm2

Download and run latest Iterm2.

Move it to Applications folder.

Install XCode

xcode-select --install

Verify that XCode is successfully installed:

xcode-select -p

It should show:

/Library/Developer/CommandLineTools

Software Update

Run Software Update Tool:

softwareupdate --all --install --force

Install Homebrew

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

If you get this error Failed to link all completions, docs and manpages: Permission denied run:

sudo chown -R $USER:admin /usr/local/*

Run update:

brew update

Run below checkup:

brew doctor

It should show:

Your system is ready to brew.

Homebrew Update Applications

brew update
brew outdated
brew upgrade

Update Bash

Install Bash 5.1:

brew install bash

Change default bash to latest:

sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash

Restart your terminal.

Check bash version:

bash --version

It should show:

GNU bash, version 5.1.12(1)-release (x86_64-apple-darwin20.6.0)

Install Oh My Zsh

https://ohmyz.sh/

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

Install Warp

https://www.warp.dev/

Install NerdFont

https://www.nerdfonts.com/font-downloads

e.g.

brew install --cask font-hack-nerd-font

Update iTerm to use the font:

Select Settings...Profiles...Text and select "Hack Nerd Font" from the Font drop-down and increase the Size to 16.

Also consider checking the "Use ligatures" checkbox. A new terminal window must be opened for the changes to take effect.

Note:

If you notice that your profile changes are not getting saved in iTerm2 after re-boot, perform these steps:

  1. Quit iTerm2
  2. Move ~/Library/Preferences/com.googlecode.iterm2.plist to the Desktop
  3. Kill iTerm2 (because plist files are protected)
  4. Launch iTerm2 and quit it again to create a new plist file at ~/Library/Preferences/com.googlecode.iterm2.plist
  5. Open ~/Library/Preferences/com.googlecode.iterm2.plist in an editor
  6. Paste the contents of the plist file on the Desktop into the new one
  7. Kill and launch iTerm2 again

Install Starship Prompt

https://github.com/starship/starship

brew install starship

Add the following to the end of ~/.zshrc:

eval "$(starship init zsh)"

Activate zsh:

source ~/.zshrc

Install Snazzy Theme

https://github.com/sindresorhus/iterm2-snazzy

To add Snazzy theme to iTerm2:

Right-click Snazzy.itermcolors and choose Save Link As…. Double-click the downloaded file.

Update iTerm to use the theme:

Select Settings...Profiles...Colors and select "Snazzy" in Color Presets.

Install zsh Syntax Highlighting

https://github.com/zsh-users/zsh-syntax-highlighting

Simply clone this repository and source the script:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Then, enable syntax highlighting in the current interactive shell:

source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Install zsh Auto Suggestions

https://github.com/zsh-users/zsh-autosuggestions

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  1. Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):
plugins=( 
    # other plugins...
    zsh-autosuggestions
)
  1. Activate zsh
source ~/.zshrc

Install Github CLI

https://github.com/cli/cli

brew install gh

To authenticate with a GitHub instance, run:

gh auth login --hostname <hostname>

Set the GH_HOST environment variable in your ~/.zshrc:

export GH_HOST=<hostname>

Install gh-dash

  1. Clone the repo
git clone https://github.com/dlvhdr/gh-dash
  1. Install the extension locally
cd gh-dash/
gh extension install .

Install wget

brew install wget

Install Autojump

https://github.com/wting/autojump

brew install autojump

Add the following line to your ~/.zshrc file:

[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

Install bat

https://github.com/sharkdp/bat

brew install bat

Install broot

https://github.com/Canop/broot

brew install broot

Install eza

https://github.com/ogham/eza

brew install eza

Install fzf

https://github.com/junegunn/fzf

brew install fzf

To install key bindings and auto-completion:

$(brew --prefix)/opt/fzf/install

Install httpie

https://github.com/httpie/httpie

brew install httpie

Install fig

https://github.com/withfig/autocomplete

brew install --cask fig

Note: You need to disable Secure Keyboard Entry in iTerm so that Fig can process keyboard events and provide suggestions. If you are pasting any sensitive data and would like to disable fig then simply enable Secure Keyboard Entry

Install tmux

brew install tmux

Install jq

brew install jq

Install WTF

brew tap wtfutil/wtfutil
brew install wtfutil

Create config file at ~/.config/wtf/config.yml

https://gist.github.com/HarshadRanganathan/e2795e2adf3fd6badc08faeeae2d609a

Install watch

brew install watch

Install Viddy

brew install viddy

Install Graphviz

brew install graphviz

Install asdf

brew install coreutils curl git

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0

Add the following to ~/.zshrc:

. "$HOME/.asdf/asdf.sh"

# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit

Install pyenv

https://github.com/pyenv/pyenv

brew install pyenv

echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

https://github.com/pyenv/pyenv/blob/master/COMMANDS.md

Install a python version:

pyenv install 3.12.3

Make python version global:

pyenv global 3.12.3

Check current active python version:

pyenv versions

Install SDKMan

https://sdkman.io/

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

Gradle

sdk install gradle

Groovy

sdk install groovy

Java

List java versions:

sdk list java

Install java sdk:

sdk install java 21.0.3-amzn

Maven

sdk install maven

Scala

sdk install scala

Install NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Node

nvm install --lts
export NVM_DIR="$HOME/.nvm"\n[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

Install Yarn

brew install yarn

Install GVM

https://github.com/moovweb/gvm

Install GVM:

zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

GVM requires pre-exisiting 'go' installation to be available, so we do this workaround:

brew install go
gvm install go1.17.3
gvm use go1.17.3
brew uninstall go

Install Terraform

https://github.com/tfutils/tfenv

brew install tfenv

Install terraform version:

tfenv install 0.12.31

Make a version default:

tfenv use 0.12.31

asdf approach:

asdf plugin add terraform https://github.com/asdf-community/asdf-hashicorp
asdf install terraform 1.5.7
asdf global terraform 1.5.7

Set plugin cache dir:

export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"

For Mac arm64 provider support issues:

brew install kreuzwerker/taps/m1-terraform-provider-helper
m1-terraform-provider-helper activate
m1-terraform-provider-helper install hashicorp/template -v v2.2.0

Install Helm

brew install helm

Install AWS CLI

  1. To specify which folder the AWS CLI is installed to, you must create an XML file. This file is an XML-formatted file that looks like the following example. Leave all values as shown, except you must replace the path /Users/myusername in line 9 with the path to the folder you want the AWS CLI installed to. The folder must already exist, or the command fails. This XML example specifies that the installer installs the AWS CLI in the folder /Users/myusername, where it creates a folder named aws-cli.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <array>
    <dict>
      <key>choiceAttribute</key>
      <string>customLocation</string>
      <key>attributeSetting</key>
      <string>/Users/myusername</string>
      <key>choiceIdentifier</key>
      <string>default</string>
    </dict>
  </array>
</plist>
  1. Download the pkg installer using the curl command. The -o option specifies the file name that the downloaded package is written to. In this example, the file is written to AWSCLIV2.pkg in the current folder.
$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
  1. Run the standard macOS installer program with the following options:
  • Specify the name of the package to install by using the -pkg parameter.

  • Specify installing to a current user only by setting the -target parameter to CurrentUserHomeDirectory.

  • Specify the path (relative to the current folder) and name of the XML file that you created in the -applyChoiceChangesXML parameter.

The following example installs the AWS CLI in the folder /Users/myusername/aws-cli.

$ installer -pkg AWSCLIV2.pkg \
            -target CurrentUserHomeDirectory \
            -applyChoiceChangesXML choices.xml
  1. Because standard user permissions typically don't allow writing to folders in your $PATH, the installer in this mode doesn't try to add the symlinks to the aws and aws_completer programs. For the AWS CLI to run correctly, you must manually create the symlinks after the installer finishes. If your $PATH includes a folder you can write to and you specify the folder as the target's path, you can run the following command without sudo. If you don't have a writable folder in your $PATH, you must use sudo for permissions to write to the specified target folder. The default location for a symlink is /usr/local/bin/.
$ sudo ln -s /Users/myusername/aws-cli/aws /usr/local/bin/aws
$ sudo ln -s /Users/myusername/aws-cli/aws_completer /usr/local/bin/aws_completer

After installation is complete, debug logs are written to /var/log/install.log.

  1. To verify that the shell can find and run the aws command in your $PATH, use the following commands.
$ which aws
/usr/local/bin/aws 
$ aws --version
aws-cli/2.3.7 Python/3.8.8 Darwin/18.7.0 botocore/2.0.0

If the aws command cannot be found, you may need to restart your terminal.

  1. To enable command completion, add below lines to your ~/.zshrc file:
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
complete -C '/usr/local/bin/aws_completer' aws
export AWS_CLI_AUTO_PROMPT=on-partial

Install AWS Shell

Install Kafka

  1. Download the required kafka version e.g. https://kafka.apache.org/24/documentation.html#quickstart_download

  2. Extract it

tar -xzf kafka_2.12-2.8.2.tgz
  1. Add the shell scripts to your path in ~/.zshrc file:
export PATH="$PATH:$HOME/path/to/kafka_2.12-2.8.2/bin"

Install Vault

brew tap hashicorp/tap
brew install hashicorp/tap/vault

Install Packer

brew tap hashicorp/tap
brew install hashicorp/tap/packer

Kubernetes Tools

Install Kubectl

brew install kubectl 

Install Krew

https://krew.sigs.k8s.io/

Run this command to download and install krew:

(
  set -x; cd "$(mktemp -d)" &&
  OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
  KREW="krew-${OS}_${ARCH}" &&
  curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
  tar zxvf "${KREW}.tar.gz" &&
  ./"${KREW}" install krew
)

Update your .zshrc file and append the following line:

export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

Install k9s

https://github.com/derailed/k9s

brew install k9s

Install kubectx

https://github.com/ahmetb/kubectx

Download the go binary from releases (0.9.0+): https://github.com/ahmetb/kubectx/releases

Extract the binary:

gzip -d kubectx_v0.9.4_darwin_x86_64.tar.gz
tar -xvf kubectx_v0.9.4_darwin_x86_64.tar

gzip -d kubectx_v0.9.5_darwin_arm64.tar.gz
tar -xvf kubectx_v0.9.5_darwin_arm64.tar

Copy the binary file to /usr/local/bin:

cp kubectx /usr/local/bin/kubectx

Install kubens

curl -sS https://webi.sh/kubens | sh

Install kube-ps1

https://github.com/jonmosco/kube-ps1

brew install kube-ps1

Add below lines to your ~/.zshrc file:

source "/opt/homebrew/opt/kube-ps1/share/kube-ps1.sh"
  PS1='$(kube_ps1)'$PS1

Install Stern

https://github.com/wercker/stern

brew install stern

Install kubefwd

https://github.com/txn2/kubefwd

brew install txn2/tap/kubefwd

Install kubectl-tree

https://github.com/ahmetb/kubectl-tree

kubectl krew install tree

Install kubectl-neat

https://github.com/itaysk/kubectl-neat

kubectl krew install neat

Aliases

Add aliases and auto-completion for various kubernetes tools by adding below lines to your ~/.zshrc file:

source <(kubectl completion zsh)
alias k=kubectl
alias kctx=kubectx
alias kns=kubens
complete -F __start_kubectl k

Tools

VSCode - https://code.visualstudio.com/

Jetbrains Toolbox - https://www.jetbrains.com/toolbox-app/

Postman - https://www.postman.com/

DBeaver - https://dbeaver.io/

Lens - https://k8slens.dev/

VSCode

Note:If you have VSCode in Downloads, move it to the Applications folder

To add code to command path:

Open the Command Palette via (⇧⌘P) and type shell command to find the Shell Command:

Install 'code' command in PATH** command.

VSCode Extensions

Prettier - Code formatter

Docker

GitLens

Code Runner

Material Icon Theme

YAML

Go

Kubernetes

Terraform

Lens Extensions

Resource Map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment