20 June 2022

Setting up a mac for development

After doing this for the fiftieth time, I thought I'd write it down somewhere.

ai generate picture of steve jobs making a mac from lego

Set up

This is a series of instructions for setting up a macbook, M1 chip, for day-to-day development, including Ruby, Docker, zsh, Postgres, MySql, GraphQL, AWS etc. Run any of this at your own risk.

# This assumes set up as done on a default mac

# login to icloud, and allow icloud. enjoy the myriad of 2FA methods across your ios devices
# enable touch ID, add yr prints

# a few commands for dev defaults
chflags nohidden ~/Library
defaults write com.apple.finder AppleShowAllFiles YES
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool true
defaults write -g com.apple.swipescrolldirection -bool FALSE
mkdir ~/Scripts

# go 
# imagemagick stuff
brew install go vips pkg-config
go get -u github.com/davidbyttow/govips/v2/vips

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

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/admin/.zprofile
  eval "$(/opt/homebrew/bin/brew shellenv)"
brew install node

brew install rbenv ruby-build

npm install -g n
# make cache folder (if missing) and take ownership (for n)
sudo mkdir -p /usr/local/n
sudo chown -R $(whoami) /usr/local/n
# make sure the required folders exist (safe to execute even if they already exist)
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
# take ownership of Node.js install destination folders
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share

brew install cask hyper
brew install zsh wget
chsh -s /bin/zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
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-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

sed -ir 's/^plugins=.*/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/g' .zshrc
brew install git yarn p7zip
git config —global user.name "Kevin Sedgley"
brew install --cask 1password/tap/1password-cli
brew install --cask github
brew tap homebrew/services
brew install [email protected] postgresql
brew tap mongodb/brew
brew install gpg2
brew install postman 
npm install -g vue-cli
brew install --cask docker
brew install graphql-playground --cask
brew install graphviz
brew install awscli

cd ~/Scripts
curl -o govuk-prototype-kit.zip -L https://govuk-prototype-kit.herokuapp.com/docs/download
unzip govuk-prototype-kit.zip
rm govuk-prototype-kit.zip
cd -

mkdir ~/.ssh

brew install terraform ansible