Dev Setup of a Mac

After working in my 2nd consecutive company that uses Mac's for developers and having forgot everything I used the first time, I thought I better write down all the tweaks, work arounds and config changes that got me using my mac efficiently.

Remap Fn-C to copy

Mac's use Mac-C instead of Ctrl-C to copy (and X, V to cut and paste). This is really annoying if you switch between a mac and Windows machine a lot. Fortunately you can use Karabiner to map Fn-C to copy as the Fn key is located where Ctrl is on a windows keyboard. If your on OSX Sierra you'll need to use Karabiner Elements for now.

Git

Just run git from the command line and it will prompt you to install xcode tools.

homebrew

This needs to be installed first as it installs most dev tools.
Note: if your behind a corporate proxy you'll need to run export HTTPS_PROXY=http://yourproxy:port first.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

A better terminal

brew cask install iterm2

Colour ls 

From this Stackexchange post, edit ~/.bash_profile:
export CLICOLOR=1
export LSCOLORS= gxBxhxDxfxhxhxhxhxcxcx

Colour vim 

edit ~/.vimrc:
syntax on

AWS etc

awslogs is a cloudwatch log watcher (you may have to run the install as sudo)

brew install python
# this is needed as brew installs the commands as python2, pip2 etc
echo 'export PATH="/usr/local/opt/python/libexec/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install awscli
pip install awslogs

Tunneling

sshuttle - a handy python ssh tunnelling that allows you to easily route ranges of IPs over ssh.

pip install sshuttle

Ruby

brew install rbenv
Add the following to ~/bash_profile
eval "$(rbenv init -)"
Then run
rbenv install 2.2.3
rbenv global 2.2.3

Java

brew cask install java
brew install gradle
Then add this to ~/.bash_profile:
export JAVA_HOME=$(/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home)

node.js / nvm

To install node, it's best to use only nvm to handle the installations.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Cntlm

cntlm is a local proxy that makes dealing with a corporate proxy a bit easier.
brew install cntlm

Corkscrew

Corkscrew is a ssh proxy tunneler that allows ssh through https.
brew install corkscrew

GPG Suite

brew cask install gpg-suite

Graphviz with gui

As per How to open dot on Mac
brew install graphviz --with-app
If you get the following error:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Then the instructions here work. My specific fix was just:
  1. Install Xcode 
  2. Run:
    sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Comments