The Wayback Machine - https://web.archive.org/web/20211109034647/https://github.com/xmlking/macbooksetup
Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Mac Developer Setup

Installation steps below assume that you are have Admin Access currently enabled

Mac Setup


Apps Installation

based on you needed, install following software

  • Microsoft Office
  • Chrome
  • Xcode
  • IntelliJ
  • kubernetic

Xcode/ Xcode Command Line Tools is requred even if you don't use xcode, for NodeJS, GoLang etc to work.


Install Apps via brew cask

brew install --cask --appdir=~/Applications xyz will install into user Apps (i.e., ~/Applications)
if you have admin privilege you can skip --appdir=~/Applications flag

for iterm2, I prefer installing Nightly Builds from https://www.iterm2.com/downloads.html

brew install --cask --appdir=~/Applications iterm2
brew install --cask --appdir=~/Applications sublime-text
brew install --cask --appdir=~/Applications visual-studio-code
brew install --cask --appdir=~/Applications bloomrpc

Post xcode install

Check if the full Xcode package is already installed:

$ xcode-select -p

If you see:

/Library/Developer/CommandLineTools

the full Xcode package is already installed. Otherwise:

xcode-select --install

You should see the pop up below on your screen. Click Install when it appears.

Once the software is installed, click Done.

Before you go to the next step, verify that you’ve successfully installed Xcode Command Line Tools:

$ xcode-select -p

You should see:

/Library/Developer/CommandLineTools

Just to be certain, verify that gcc is installed:

$ gcc --version

If all went well, you should see the GCC version in the output.

It will show something like this:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Developer Mode

Enable Developer Mode on this Mac so that you can use debugger and other dev tools

# check status
DevToolsSecurity -status
# DevToolsSecurity -status -verbose

#  substitute your username in palace of <username>
DevToolsSecurity -enable
# or
sudo dscl . append /Groups/_developer GroupMembership <username>

Homebrew

Reference Homebrew for detailed instructions.

Go to terminal and run:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If you don't have admin access to your laptop(e.g., company issued laptop), recomend installing brew in your home directory. In this case follow these steps

cd $HOME
git clone https://github.com/mxcl/homebrew.git

then add brew to front of PATH by editing your shell profile file and adding below lines:

export BREW_HOME=$HOME/homebrew
export PATH=$BREW_HOME/bin:$PATH

Once the installation is successful, run the following command:

$ brew doctor

If you get Your system is ready to brew, you can move on to the next step.


Homebrew Software Installations

To update brew:

$ brew update

# tools
brew install watch
brew install jq
brew install git
brew install git-flow-avh
brew install hub
brew install ack
brew install tree
brew install vim
# a better `cat`
brew install bat
# a better `curl`
brew install httpie
# better then a Makefile
brew install go-task/tap/go-task

## languages
# node
brew install node
brew install yarn

brew install python

# GoLang
brew install protobuf
brew install go
# grpc cli client
brew install grpc

# ETL
brew install benthos

# Developer IDE Fonts
brew tap homebrew/cask-fonts
brew install --cask font-source-code-pro
brew install --cask font-fira-code

## kubernetes
# if you are going to install `docker-for-mac`, it comes with `kubectl` and don't need install it again via brew.
brew install kubectl
brew install k3d
brew install kubectx
brew install kustomize
brew install kubernetes-helm
# Manage Your lk8s In Style!
brew install derailed/k9s/k9s
brew install istioctl
# A tool for exploring each layer in a docker image
brew install dive
# build and deploy docker images
brew install skaffold

# gcloud cli
brew cask install google-cloud-sdk
# Note: if you see failures (e.g., 503) during the google-cloud-sdk installation, you may need to set your python proxy and re-run the command. e.g.,
# export HTTP_PROXY="http://user:password@hostname:port"
# export HTTPS_PROXY="http://user:password@hostname:port"

zsh

Reference zsh for detailed instructions.

Install Oh My Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

The installation script should set zsh to your default shell, but if it doesn't you can do it manually:

chsh -s $(which zsh)

iTerm2

Follow iTerm2 Configuration for applying the color scheme, install fonts, Oh my Zsh add-ons. Note: use Powerlevel10k instead of Powerlevel9k

Powerlevel10k

Follow Offical Powerlevel10k or Opinionated Powerlevel10k instructions

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Note: After Powerlevel10k setup, when you restart iTerm2 first time, it will ask you to install MesloLGS NF font and sequence of questions to customize prompt. To customize prompt again, run p10k configure or edit ~/.p10k.zsh.

plugins

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions

Then add the plugin to the list of plugins in ~/.zshrc configuration file:

plugins=(
    zsh-syntax-highlighting
    zsh-autosuggestions
    zsh-completions
)

Download and install first [MesloLGS NF Regular] patched font for terminal use

other terminal fonts are optional

  1. MesloLGS NF Regular

Recommended to use MesloLGS NF Regular font all terminals and adjust terminal font size e.g., terminal.integrated.fontSize=14

  1. iTerm2: Open iTerm2 → Preferences → Profiles → Text and set Font to MesloLGS NF Regular

  2. Visual Studio Code: Open File → Preferences → Settings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF Regular

    e.g., "terminal.integrated.fontFamily": "MesloLGS NF, 'SourceCodePro+Powerline+Awesome Regular', Source Code Pro for Powerline, monospace, Meslo LG M for Powerline"

Download and install following color schemas for iTerm2

  1. Clovis-iTerm2-Color-Scheme

Status Bar Customization (Optional)

Install iTerm2 Shell Integration

iTerm2 > Install Shell Integration

Go into iTerm preferences and untick the indicators: Profiles > Terminal > Show mark indicators.

Add kubecontext Status Bar component

  • iTerm2 > Preferences > Profiles > Session > Configure Status Bar
  • Drag a new Interpolated String component to Active Components.
  • Select the new component and click Configure Component.
  • Set String Value to \(user.kubecontext)

Refer:

  1. https://sig.gy/itermkube/
  2. https://www.stefanjudis.com/blog/declutter-emojify-and-prettify-your-iterm2-terminal/

Rust

Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.

Installation

For installation, it's advised to use rustup as it will (among other things) allow you to switch between versions of Rust without having to download anything additional.

brew install rustup

Use rustup to install the Rust compiler (rustc) and the Rust package manager (cargo).

rustup-init

To verify you can run:

rustc --version

To upgrade rustup

brew upgrade rustup
# or
rustup self update

Enable tab completion for Zsh

rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion

To update rust

rustup update
rustup update stable

Setup Work Directories

Go to terminal and run the following commands:

To go your home directory:

$ cd ~

Make 'Developer' directory:

$ mkdir -p ~/Developer

Change directory to Developer

$ cd ~/Developer

Make 'Work' directory under ~/Developer:

$ mkdir Work

Make 'Apps' directory under ~/Developer:

$ mkdir Apps

Change directory to ~/Developer/Work

$ cd Work

Make SPA , go, java etc directories under ~/Developer/Work:

mkdir SPA
mkdir go
mkdir rust
mkdir java
mkdir node
mkdir tools

VSCode

Go to VSCode and install VSCode if you prefer VSCode instead of Intellij

Create a shortcut to launch Visual Studio Code in terminal

cd ~
mkdir bin
# change `schintha` to your user name
ln -s "/Users/schintha/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" ~/bin/code

To open dir in Visual Studio Code from terminal:

$ ~/bin/code dir.name


Sublime Text 3

Reference SublimeText for detailed instructions.

you can use my user preferences

Install package control

Ref: https://packagecontrol.io/installation

Install Package control by going to Sublime Text Console. Access console by View > Show Console menu. Once open, paste the following python code:

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)


Install packages

Go to Sublime and do CMD + Shift + P

Type 'install' and select 'Package Control: Install Package'

Install the 5 packages listed below:

  1. Theme - Soda
  2. SCSS
  3. Markdown Preview
  4. Monokai Extended
  5. TypeScript

Afterwards, go to Preferences -> Settings-User and copy and paste following JSON

{
  "bold_folder_labels": true,
  "color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
  "font_face": "Consolas",
  "font_size": 14,
  "highlight_line": true,
  "highlight_modified_tabs": true,
  "ignored_packages": ["Vintage"],
  "indent_to_bracket": true,
  "rulers": [79],
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "word_wrap": false
}

Create a shortcut to launch Sublime Text in terminal

 cd ~
 mkdir bin
# change `schintha` to your user name
 ln -s "/Users/schintha/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

To open file in Sublime Text from terminal:

$ ~/bin/subl file.name


iTerm2 More

iTerm2 setup for day-to-day use

  1. enable iterm2 Session Restoration

in iTerm2

  1. split screen horizontally
  2. go to the bottom screen and split it vertically

I was using top screen for the work with yaml files and kubectl.

Left bottom screen was running:

watch kubectl get pods

Right bottom screen was running:

watch "kubectl get events --sort-by='{.lastTimestamp}' | tail -6"

With such setup it was easy to observe in real time how my pods are being created.


SDKMan

Go to terminal and run:

$ curl -s "https://get.sdkman.io" | bash

Then execute contents in file via:

$ source "$HOME/.sdkman/bin/sdkman-init.sh"

Verify the installation went well

$ sdk version


SDKman Software Installations

To get a list of current or candidate versions for gradle:

sdk list java

To install the following software, go to terminal and run:

# if you want to manage java version with `sdkman`
# java  `17.0.0.x.y-amzn` is current long-term support (LTS).
sdk install java 17.0.0.35.2-amzn

sdk install gradle
sdk install maven

#optional
sdk install kotlin
sdk install scala
sdk install springboot

When you prompted to set the newly installed software as default enter 'Y'

How to use sdkman

To see what is outdated for all Candidates

sdk upgrade

To remove old version e.g., gradle 5.6.2:

$ sdk remove gradle 5.6.2


Docker

Download Docker at https://docs.docker.com/docker-for-mac/

Follow instructions here to setup Docker and kubernetes


Kubernetes

Go to k3s on macOS and follow instructions to setup Kubernetes cluster for local testing

Istio (optional)

Go to Istio for MacOS and follow instructions to setup Istio with Kubernetes for local development


Istio

Go to Istio for MacOS and follow instructions to setup Istio with Kubernetes for local development


Setup Profile

All the above setting already backed into following dot(.) files

copy zshrc, alias etc., files to your home directory to make life easy.

to finish this task, run the following commands in terminal:

# go to your home dir
cd ~
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/.zshrc
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/.p10k.zsh
# change `name` and `email` in `.gitconfig` after copy
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/.gitconfig
mkdir ~/my && cd ~/my
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/.gitattributes
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/.gitignore
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/aliases.zsh
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/exports.zsh
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/extra.zsh
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/functions.zsh
curl -O https://raw.githubusercontent.com/xmlking/macbooksetup/master/home/my/paths.zsh

If you want to add paths or exports use respective files in ~/my folder instead of editing ~/.zshrc


Optional

Cloud SDK

Install Google cloud SDK using your favourite method, e.g.

brew install --cask google-cloud-sdk

Log in to Google Cloud and select your project, region, etc.

gcloud init # --console-only if in a remote shell

gcloud has an interactive shell if you wish to use it:

gcloud components install beta
gcloud beta interactive

# Testing The CLI Setup
gcloud auth login
gcloud auth list


# List the sdk configuration
gcloud config list
gcloud info

# hook it up to GCR so you can push containers:
gcloud auth configure-docker

Scripting

Write shell scripts with Google's zx

yarn global add zx

References

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages