Skip to content

sohailRa/macbooksetup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 cask install --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 cask install --appdir=~/Applications iterm2
brew cask install --appdir=~/Applications sublime-text
brew cask info --appdir=~/Applications visual-studio-code
brew cask install --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)"

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 zsh
brew install watch
brew install jq
brew install git
brew install git-flow-avh
brew install ack
brew install tree
brew install vim
# a better `cat`
brew install bat

## languages
# node
brew install node
brew install yarn

brew install python

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

# Developer IDE Fonts
brew tap homebrew/cask-fonts 
brew cask install font-source-code-pro
brew cask install 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 kubectx
brew install kubernetes-cli
brew install kustomize
brew install kubernetes-helm
# Manage Your lk8s In Style!
brew install derailed/k9s/k9s

# gcloud cli
brew cask install google-cloud-sdk

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

Node: 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

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

other terminal fonts are optional

  1. MesloLGS NF Regular
  2. Meslo LG M Regular for Powerline
  3. Source Code Pro for Powerline
  4. SourceCodePro+Powerline+Awesome+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
  2. Dracula
  3. Solarized Dark

Recommended to set iTerm2 Color Scheme to 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/

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 java

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/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  `13.0.0-open` is current long-term support (LTS). 
sdk install java 13.0.0-open
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 Kubernetes for MacOS and follow instructions to setup Kubernetes with Docker for Mac for local development


Cloud SDK (optional)

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

brew cask install 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

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


References

About

New MacOS setup for developers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%