I decided to bite the bullet and upgrade my trusty Macbook Pro from Mavericks to Yosemite and taken the opportunity to give the machine a bit of a cleanup. I thought a quick post about how I configure everything I need to do my work.

Choosing an account name

There’s not much to do during the initial OS X setup wizard however I do make sure I set my account name to something simple like adam rather than my full name. It makes it easier when you need to open your home directory at /Users/adam or when you want to login using SSH.

System Configuration

Once OS X is booted, there are a few things I like to configure within OS X itself before I install anything. All of these are carried out in System Preferences.

Input Device Configuration

  • Disable natural scrolling on the trackpad and/or mouse.

  • Whack the key repeat rate and delay until repeat values to fastest and slowest respectively.

  • Disable the Spotlight search keyboard shortcut. I will be installing Alfred later on which I want to map to the same keyboard shortcut.

  • Enable tab to move between All Controls rather than just text boxes.

  • Change the default screenshot shorts from Shift+Cmd+F4 to Shift+Cmd+F5. I will be using a different screenshot tool and would like to use this shortcut within that app.

Sharing, access & security

  • Disable the Guest user under User & Groups.

  • Enable Remote Login (SSH). You never know when you’ll need to get back into your machine from elsewhere.

  • Change your hostname to something less crazy. There’s nothing cool about Adams-Macbook-Pro.local, I much prefer something short like adam-mbp.local.

  • Require a password immediately after after starting a screensaver or sleeping.

  • Turn on FileVault to encrypt your hard disk. If your laptop gets stolen, you don’t really want someone reading all your data so easily.

There may be some other settings you want to do (like auto hiding the Dock or adjusting the spacing of icons on the desktop).

Homebrew

Homebrew is a package manager for OS X. It’s bloody brilliant and will save you a huge amount of time. Begin by installing Homebrew and Homebrew Cask.

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
$ brew install caskroom/cask/brew-cask  

Installing Apps with Cask

Cask makes it really easy to install OS X applications without going to every vendor’s website and downloading the files yourself.

  • Google Chrome — I enjoy the syncing of data between different Chrome instances.

  • 1Password — an excellent password manager. I use (and you should too) use a different password for every service which asks for one and 1password keeps them safe for me

  • Dropbox — everyone’s favourite file sharing service. We use this at aTech to store our active project files — things like PSDs and documents which don’t really belong in a Git repository.

  • iTerm2 — a replacement for the built-in Terminal application.

  • Spotify — music.

  • DropShare — a great tool for uploading files & screenshots to an SFTP service. I use this for sharing screenshots all over the internet.

  • Adobe Creative Cloud — I love Photoshop, Illustrator, InDesign and other things.

  • Hipchat — we use this at aTech for chatting during the day and generally sharing banter.

  • Postbox — having tried hundreds of mail clients I have settled on this for a while.

  • Alfred — my Spotlight replacement.

$ brew cask install google-chrome  
$ brew cask install 1password  
$ brew cask install dropbox  
$ brew cask install iterm2  
$ brew cask install spotify  
$ brew cask install dropshare  
$ brew cask install adobe-creative-cloud  
$ brew cask install slack  
$ brew cask install postbox  
$ brew cask install alfred  

### Installing Apps from the App Store

In addition to these apps, there are a number of apps that I usually download from the Apple App Store.

  • Navicat — a great little tool for managing MySQL & PostgreSQL databases.

  • DaisyDisk — when you run out of disk space, DaisyDisk makes it simple to find out how you’re using the space.

  • Twitter — call me old school but I still use the official Twitter client for OS X.

  • XCode — essential for developing OS X applications.

  • Wunderlist — I use this for keeping track of little tasks I need to do on a daily basis.

I’m primarily a Ruby developer working with numerous versions of Ruby plus all the things which come with that (MySQL, PostgreSQL etc…)

Installing Ruby

I use rbenv to manage running multiple versions of Ruby at the same time. I install rbenv by just cloning the repository into ~/.rbenv. Follow the instructions on the site to get that up and running.

Once installed, you’ll also want to go ahead and install ruby-build. This is an rbenv plugin which will automatically download & compile any version of Ruby for you.

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

You can then install the versions of Ruby that you want to use on your system as well as setting your default.

$ rbenv install 2.2.1
$ rbenv global 2.2.1
$ gem install bundler

Install MySQL Server

If you use MySQL, you’ll need a local MySQL Server. Homebrew makes this easy. I install MySQL Server and then use launchctl to ensure that it always starts on boot.

$ brew install mysql
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Installing PostgreSQL, Mongo, Redis & RabbitMQ

$ brew install postgresql
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

$ brew install mongodb
$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

$ brew install redis
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

$ brew install rabbitmq
$ ln -sfv /usr/local/opt/rabbitmq/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist

Dotfiles

I’ve been working on a .bash_profile for years and here’s a few highlights of things things that I include to make using Bash a little easier.

# Export unlimited history and don't add any
# references to resetting git or databases to the 
# history to avoid accidental use.
export HISTSIZE=  
export HISTFILESIZE=  
export HISTIGNORE='git reset --hard:rm -rf:rake db:reset'  
export HISTCONTROL=ignorespace

# Default RAILS_ENV to development
export RAILS_ENV=development

# Setup some useful aliases to avoid running bundle
# exec in front of each command (as I don't use binstubs).
alias be="bundle exec"  
alias rake="be rake"  
alias rspec="be rspec"  
alias dbm="be rake db:migrate"  
alias dbr="be rake db:rollback"  
alias rg="be rails generate"  
alias rr="be rails runner"  
alias rc="be rails console"  
alias foreman="be foreman"  
alias procman="be procman"  
alias cap="be cap"  
alias yard="be yard"  
alias rackup="be rackup"  
alias annotate="be annotate"  
alias rbg="be rbg"

# A method to return the current branch
function current_branch() {  
  ref=$(git symbolic-ref HEAD 2> /dev/null) || \
  ref=$(git rev-parse --short HEAD 2> /dev/null) || return
  echo -e " \033[33m(${ref#refs/heads/})\033[0m"
}

# Change the PS1 of the shell to include the current
# git branch
export PS1="\[\e[034m\]\W\[\e[0m\]\$(current_branch) $ "

# Use color when using `less`
export LESS='-R'  
export LESSOPEN='|~/.lessfilter %s'

In addition to this, I also have a global configuration file for Git. This is stored in ~/.gitconfig.

[color]
    diff = auto
    status = auto
    branch = auto

[apply]
    whitespace = nowarn

[core]
    excludesfile = /Users/adam/.gitignore
    quotepath = false
    editor = /Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl -n -w

[branch]
    autosetuprebase = always
    rebase = true

[push]
    default = matching

[alias]
    stats = shortlog -n -s -e
    ci = commit -a -v
    co = checkout
    a = add .
    l = log
    s = status
    pl = pull
    ps = push
    lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit

This file also references a global .gitignore file which contains a number of files which I never want checked into a Git repository.

._*
.rvmrc*
.DS_Store
.powrc
.powenv
.powder
*.gem

Tell us how you feel about this post?