Skip to content

Instantly share code, notes, and snippets.

@luzlab
Last active June 11, 2024 18:41
Show Gist options
  • Save luzlab/acdd0a519a30629412ff896d403d1606 to your computer and use it in GitHub Desktop.
Save luzlab/acdd0a519a30629412ff896d403d1606 to your computer and use it in GitHub Desktop.
Mac Developer Setup
# Inspired by https://gist.github.com/kevinelliott/7a152c556a83b322e0a8cd2df128235c
##############################################################################
# Install brew and base set of packages
##############################################################################
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# might need to run `sudo chown -R $USER:admin /usr/local` if install fails because of permissions issue.
brew update && brew upgrade
brew install docker docker-compose git wget jq coreutils binutils gitversion pkg-config grep gnu-sed gnu-tar yq homeport/tap/dyff zplug nvm
### Optional dev install
Brew install kafkacat bfg
gsed -i '1i\PATH=$HOME/bin:/usr/local/bin:/usr/local/opt/curl/bin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:$PATH' $HOME/.zshrc
touch .zshenv
gsed -i '1i\PATH=$HOME/bin:/usr/local/bin:/usr/local/opt/curl/bin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:$PATH' $HOME/.zshenv
echo 'MANPATH=/usr/local/opt/grep/libexec/gnuman:/usr/local/opt/coreutils/libexec/gnuman:/usr/local/opt/gnu-sed/libexec/gnuman:/usr/local/opt/gnu-tar/libexec/gnuman:$MANPATH' >> $HOME/.zshrc
alias ll="gls -la --color=tty"
alias l='gls --color=tty -lah'
alias la='gls --color=tty -lAh'
alias ll='gls --color=tty -la'
alias ls='gls --color=tty'
alias lsa='gls --color=tty -lah'
mkdir $HOME/bin
ln -s `which gdircolors` $HOME/bin/dircolors
### QUIT AND RELAUNCH TERMINAL ###
##############################################################################
# Configure zsh
##############################################################################
# this is easier with ZPlug than with previous using Zsh
##############################################################################
# Shell Configuration
##############################################################################
### QUIT AND RELAUNCH TERMINAL ###
echo "TERM=xterm-256color” >> $HOME/.zshrc
setupsolarized dircolors.256dark
echo 'export HISTSIZE=50000' >> $HOME/.zshrc # How many lines of history to keep in memory
echo 'export HISTFILE=~/.zsh_history' >> $HOME/.zshrc # Where to save history to disk
echo 'export SAVEHIST=50000' >> $HOME/.zshrc # Number of history entries to save to disk
echo '#export HISTDUP=erase' >> $HOME/.zshrc # Erase duplicates in the history file
echo 'setopt appendhistory' >> $HOME/.zshrc # Append history to the history file (no overwriting)
echo 'setopt sharehistory' >> $HOME/.zshrc # Share history across terminals
echo 'setopt incappendhistory' >> $HOME/.zshrc # Immediately append to the history file, not just when a term is killed
# colorize the output of `ls`
curl https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.ansi-dark > $HOME/.dircolors
# curl https://raw.github.com/trapd00r/LS_COLORS/master/LS_COLORS > $HOME/.dircolors # another color scheme
echo 'eval $(dircolors -b $HOME/.dircolors)' >> $HOME/.zshrc
# command aliases and other customizations
#echo 'alias XX="XXX"' >> $HOME/.zshrc
#alias nvm-meteor="nvm install \`meteor node -v\` && npm install --global npm@\`meteor npm -v\`"
echo "alias draw.io=/Applications/draw.io.app/Contents/MacOS/draw.io" >> ~/.zshrc
echo 'alias diff=colordiff' >> $HOME/.zshrc
##############################################################################
# QUIT AND REOPEN YOUR SHELL AT THIS POINT
##############################################################################
##############################################################################
# Install apps
##############################################################################
brew install --cask iterm2 p4v visual-studio-code drawio gpg-suite sourcetree postman
ln -s /Applications/p4merge.app/Contents/Resources/launchp4merge /usr/local/bin/p4merge
##############################################################################
# Install AppStore apps
##############################################################################
brew install mas
# Make sure you've signed into the App Store with your iCloud account
mas install `mas search "remote desktop" | grep -oP '[0-9]*?(?=\s+Microsoft Remote Desktop)'`
# Brew now installs the Xcode CLI tools so it's not necessary to download xcode anymore
# mas install `mas search xcode | grep -oP '[0-9]*?(?=\s+Xcode)'`
# sudo xcodebuild -license # accept the license for Xcode
# xcode-select --install
##############################################################################
# Git general config
##############################################################################
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignore
git config --global user.name "Carlo Quinonez"
git config --global user.email "carlo.quinonez@thermofisher.com"
git config --global core.editor "code -n -w --disable-extensions"
git config --global color.ui true
git config --global core.excludesfile ~/.gitignore_global
##############################################################################
# Git diff and merge config
##############################################################################
git config --global diff.tool /usr/local/bin/p4merge
# git config --global difftool.p4mergetool.cmd \
# "/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"
git config --global merge.tool /usr/local/bin/p4merge
git config --global mergetool.p4merge.trustExitCode true
git config --global mergetool.keepBackup true
git config --global mergetool.keepTemporaries true
git config --global mergetool.prompt true
##############################################################################
# Improve git diffs
##############################################################################
git config --global diff.compactionHeuristic 1
# git config --global pager.log "`brew --prefix`/bin/colordiff | less"
# git config --global pager.show "`brew --prefix`/bin/colordiff | less"
# git config --global pager.diff "`brew --prefix`/bin/colordiff | less"
# git config --global interactive.diffFilter "`brew --prefix`/bin/colordiff"
# https://www.viget.com/articles/dress-up-your-git-diffs-with-word-level-highlights/
# https://michaelheap.com/git-and-diff-highlight/
##############################################################################
# Set default editors for brew
##############################################################################
echo 'export HOMEBREW_EDITOR=code' >> $HOME/.zshrc
echo 'export VISUAL=code' >> $HOME/.zshrc
##############################################################################
# Install drivers
##############################################################################
brew tap caskroom/drivers
brew cask install ftdi-vcp-driver
##############################################################################
# Install fonts
##############################################################################
brew tap homebrew/cask-fonts
brew install font-inconsolata
# power line fonts for zsh command prompt
brew install font-consolas-for-powerline
brew install font-fira-mono-for-powerline
Brew install font-sf-compact font-sf-mono-for-powerline font-sf-pro
brew install font-victor-mono
wget https://raw.githubusercontent.com/ryanoasis/nerd-fonts/6c6ef8ef0ca382efbd39bd709007e6ee8f64edbf/patched-fonts/PragmataPro%20for%20Powerline%20Plus%20Nerd%20File%20Types.ttf
https://github.com/ryanoasis/nerd-fonts/blob/6c6ef8ef0ca382efbd39bd709007e6ee8f64edbf/patched-fonts/PragmataPro%20for%20Powerline%20Plus%20Nerd%20File%20Types.ttf
##############################################################################
# Docker-machine
##############################################################################
# https://www.definit.co.uk/2021/09/replacing-docker-desktop-with-vmware-fusion-or-workstation/
brew install vmware-fusion
sudo SetFile -a V "/Users/carloquinonez/.vctl/Fusion Container Storage.sparseimage"
# use `vctl` instaead of Docker Desktop
##############################################################################
# Node Application development
##############################################################################
PROFILE='.zshrc' wget -qO- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
echo 'export NODE_ENV="development"' >> $HOME/.zshrc # Set the default NODE_ENV to development
##############################################################################
# Azure DevOps and Development
##############################################################################
brew install azure-cli microsoft-azure-storage-explorer azure-data-studio
##############################################################################
# Confluent
##############################################################################
brew install confluent-cli
echo '# load confluent completion' >> $HOME/.zshrc
echo 'source <(confluent completion zsh)' >> $HOME/.zshrc
echo 'source /usr/local/etc/bash_completion.d/az' >> $HOME/.zshrc
curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash
echo 'export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig' >> $HOME/.zshenv
echo 'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/readline/lib/pkgconfig' >> $HOME/.zshenv
##############################################################################
# Misc MacOS configs
##############################################################################
chflags nohidden ~/Library # Show the ~/Library folder
mkdir ~/Screenshots # Store screenshots in subfolder on desktop
defaults write com.apple.screencapture location ~/Screenshots
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true # Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write com.apple.Notes SmartQuotes -bool false # Turn off smart quotes in Notes
defaults write com.apple.Notes SmartDashes -bool false # Turn off smart dashes in Notes
sudo spctl --master-disable # allow apps from anywhere to run (restores "anywhere" option in system prefs)
sudo sed -i '2iauth sufficient pam_tid.so' /etc/pam.d/sudo # enable Touch Bar for sudo!
# Fix preferences in iTerm2->Preferences > Advanced > (Goto the Session heading) > Allow sessions to survive logging out and back in.
# By default, word jumps (option + → or ←) and word deletions (option + backspace) do not work. To enable these, go to "iTerm → # Preferences → Profiles → Keys → Presets... → Natural Text Editing
# sudo nvram boot # Boot into versbose mode
##############################################################################
# SSH Keys and Other Credentials
##############################################################################
ssh-keygen -t rsa -m PEM -C "MacBook Air"
# the "-m PEM" option ensure the keys are as compatible as possible. Azure Key Vault won't accept them otherwise.
@luzlab
Copy link
Author

luzlab commented Dec 6, 2021

sadf

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