Skip to content

Instantly share code, notes, and snippets.

@nheeren
Last active November 6, 2015 10:37
Show Gist options
  • Save nheeren/3cec2fe3c00e8733ea56 to your computer and use it in GitHub Desktop.
Save nheeren/3cec2fe3c00e8733ea56 to your computer and use it in GitHub Desktop.
MacBook Pro setup

A semi-expert's OS X install guide for a MacBook Pro (mid-2012)

This page describes how to make a clean setup of OS X on my mid-2012 MacBook Pro. It describes my favourite settings and Apps (adapted to this computer). A focus lies on open-source tools. It is a totally subjective selection. Feel free to fork.

This guide is based on my OS X experience and on a couple of other guides, including:

Preparing the install disk

Ideally I use an install disk to boot from. DiskMakerX proved useful over the years. But Apple finally also introduced a tool for making OS X installer disks, called createinstallmedia. So something like this should do:

sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install\ OS\ X\ Yosemite.app

Installation

  1. Optional: Reset NVRAM and SMC - You wont believe what data is stored there...
  2. Boot the install disk by pressing alt at the boot screen
  3. Wipe the entire disk using Disk Utility. Make sure to use HFS+ Journaled and the GUID partition table.
  4. During installation create your admin account.
  5. It is not necessary to setup iCloud or WiFi for installing OS X.

User world

Create a user account user (without admin rights) for everyday use. Not using the admin account adds an additional security layer.

Terminal

Home is where my .bash_profile is. See below for goodies like iTerm2 and Homebrew.

TODO:

  • bash_profile
  • bash_alias

Colors

http://bashrcgenerator.com/

### Finder

System settings

  • On Macs with a non-Apple SSD, activate TRIM, using sudo trimforce enable.
  • Activate FileVault2 (Ideally leave the encryption process finish, before rebooting.)

sleep behavior

Most settings like disk sleep, and display sleep can be set conveniently in System Preferences > Energy Saver. For some things it is necessary to use pmset. However, it is notoriously difficult to make a Mac sleep the way you want it to and pmset does not always behave as expected. In my case standby will kick in although hibernatemode is set to 0, which, according to the pmset manual, should not happen.

  • sudo pmset -b standbydelay 43200 - wait for 12 hours before hibernating, when on battery
  • sudo pmset -c standbydelay 172800 - wait for 48 hours before hibernating, when on AC power
  • sudo pmset -b autopoweroffdelay 720 - not sure about the difference between standby and autopoweroff. Note this one is in minutes...
  • sudo pmset -c autopoweroffdelay 2880
  • sudo pmset -a acwake 0 - do not wake the Mac when (un-) plugging the charger. This can be extremely annoying, especially with full disk encryption.

TODO

Restore data

So the whole point of doing a clean install of OS X is that I do not want all the cruft that piled up over the years. So what I do:

  1. Create dummy user account temp_user
  2. Run Migration Assistant from temp_user
  3. Copy only the necessary files from Users/temp_user/Library to Users/user/Library
  4. Correct permissions (i.e. from temp_user to user)
  • either use the the Recovery Assistant (cmd+R at boot screen),
  • Onyx,
  • command line, or
  • file info (cmd+i on Users/user/Library). Make sure to click on 'apply on enclosed items'.

Bootcamp

It is actually pretty difficult to restore a working Bootcamp image. There are tools like Winclone that claim to be able to do that. My one-time try did not prove successful, however. Usually I will do a clean re-install of Windows as well. The Bootcamp Assistant helps with the installation procedure.

Applications

First download most important Apps and Tools

System

  • iTerm2
  • Onyx
  • Homebrew - see section below
  • SmartSleep - includes some helpful sleeping tools and manages the hibernate file
  • iStat Menus (commercial)
  • KeePassX - Manage passwords
  • pgAdmin3 - Manage postgresql databases

Internet

  • Little Snitch (commercial) - OS X is talking a lot with its homebase...
  • Firefox
  • VPN Monitor (AppStore, commercial)

Other

  • pyCharm (commercial)
  • Atom
  • TextWrangler - powerful text editor
  • GIMP - Photo editing at its best
  • InkScape - Although not very well supported anymore (XQuartz), still a very valuable vector graphics tool.
  • BackupLoupe - Investigate Time Machine backups
  • LaTeX - Use BasicTEX, a much smaller version of MacTex and sufficient

Homebrew

One major inconvenience of Homebrew is that it is difficult to set up in multi user environments. Also setup for a non-Admin account requires more work. This guide explains a multi-user setup. Basically you will have to create a dedicated user group.

  1. Create a user group brew in System Preferences
  2. sudo chgrp -R brew /usr/local
  3. sudo chmod -R g+w /usr/local
  4. sudo chgrp -R brew /Library/Caches/Homebrew
  5. sudo chmod -R g+w /Library/Caches/Homebrew
  6. chgrp -R brew /opt/homebrew-cask
  7. chmod -R g+w /opt/homebrew-cask
  8. sudo chown -R admin /opt/homebrew-cask
  9. sudo chmod -R g+w /opt/homebrew-cask
  10. brew doctor

Install

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

Cool packages

Some of these will replace outdated OS X tools.

  • bash
  • coreutils
  • findutils
  • grep
  • cowsay
  • figlet
  • afsctool - compress HFS+ files
  • openssh - OS X uses a rather old version
  • ssh-copy-id - copy a ssh key to the remote machine
  • git
  • postgresql - the only database you will ever need
  • check_postgres
  • postgis - Postgres GIS extension
  • pgtune - Tuning utility for Postgres
  • rsync
  • rsnapshot
  • netcat
  • httrack - copy that website...
  • joe - create .gitignore files

Programming

  • Python
    • numpy
    • scipy
    • matplotlib

Backup system

TimeMachine is a very capable backup system.

TODO

It as always good to also have SuperDuper or Carbon Copy Cloner handy, e.g. for creating bootable images of your system.

TimeMachine exclusions

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