Skip to content

Instantly share code, notes, and snippets.

@zsiddiqi
Created December 25, 2016 06:47
Show Gist options
  • Save zsiddiqi/0506e996372316045022d101ffa07513 to your computer and use it in GitHub Desktop.
Save zsiddiqi/0506e996372316045022d101ffa07513 to your computer and use it in GitHub Desktop.
General notes while installing a new Mac

Installing Mac

What and Why

This is a step by step guide which was written by me for myself mostly, with the intent to use and update it whenever I install a new mac.

Note: Those instructions were last applied on a fresh Mountain Lion MacBook Pro.

Contents

AppStore

Login into the AppStore, go to "Purchases" and download all relevant apps.

In particular make sure to install Xcode.

3rd party

NOTE: some apps that are not "properly" signed will not start unless you change Gatekeeper preferences. There is a better workaround though. Right click and select 'Open', this time you will have an additional optin to open it regardless of the Gatekeeper settings.

  • Dropbox

  • 1Password

    IMPORTANT: Make sure Dropbox finished sync before you open your 1password keychain!

  • Google Chrome

    sign into your gmail account to sync prefs (you will need to create a new application specific password if you use 2-phase auth.)

    visit http://www.google.com/ncr in every browser you use so that Google will stop redirecting to the stupid local site.

  • Google Drive

  • Skype

  • LaunchBar 5

  • iTerm2

    in Settings/Terminal set 'Unlimited scrollback'

  • GitX

    Right-click -> open to open it for the first time (its not signed)

    After that go to menu GitX/Enable Terminal Usage... to enable terminal gitx command.

  • GrowlNotify

  • CCMenu

  • Adobe Air

  • HipChat

  • AppTrap

  • Postgress.app

    To create postgres user without a password like in 'regular' postgres installation:

      createuser --no-password -h localhost postgres
      echo /Applications/Postgres.app/Contents/MacOS/bin | sudo tee /etc/paths.d/postgres
    
  • SequelPro

  • Transmission

  • VLC

  • Things

    configure 'ctrl-alt-cmd-n' as quick entry with autofill

  • Stanza

    Note: site seems to be down. copy from old computer's Applications folder instead

  • Calibre

    Choose ~/Dropbox/books as the library location

  • AppFresh

  • Evernote Web Clipper

    Install Evernote from App Store first.

  • MacUpdate bundle

    From the MacUpdate bundle (stored on s3) install ScreenFlow, KeyCue, Jaksta (licenses are in 1Password)

  • Shortcat

  • Flip4Mac

top

Keychains

Copy files from ~/Library/Keychains/. rename them with some common prefix like name of the old computer.

top

Preview signatures

Copy ~/Library/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.signatures.plist from the old computer.

The keychains from the previous step should let you open it.

top

iTunes Music

  • quit iTunes on the old computer.
  • open home directory in Finder
  • right click on the Music folder and 'compress' it
  • transfer it to the new computer.
  • unpack into some temp folder
  • remove the inside content of your ~/Music folder
  • move the content of the Music folder from the old computer into ~/Music
  • in case your music library was on an external drive - make sure the drive is mounted
  • start iTunes

top

iPhoto Pictures

  • simply copy the ~/Pictures/iPhoto Library to the new computer

top

Skype history transfer

  • make sure you have the same version of Skype on both old and new computers

  • quit Skype on both computers

  • create archive of your skype id directory on the old computer, transfer it and open it at the same place at the new computer. The path is:

      ~/Library/Application Support/Skype/YOUR_SKYPE_ID
    

top

MySQL

  • Download 64bit Community Server DMG archive from MySQL.

  • Mount it

  • install 3 components:

    • mysql
    • MySQL.prefpane
    • MySQLStartupItem
  • setup paths:

      echo /usr/local/mysql/bin | sudo tee /etc/paths.d/mysql
      echo /usr/local/mysql/man | sudo tee /etc/manpaths.d/mysql
    

Library not loaded: libmysqlclient.18.dylib

If you get this error the magic incantation to fix it is this:

sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/rvm/gems/ruby-1.9.3-p286-falcon/gems/mysql2-0.2.13/lib/mysql2/mysql2.bundle

NOTE: you need to use your real mysql2.bundle path. to find it out do:

gem which mysql2

top

Copy Files

Copy the following files over:

  • ~/Documents/

  • ~/Downloads

  • ~/Desktop/

  • ~/bin/

    add ~/bin to the path:

      echo ~/bin | sudo tee /etc/paths.d/home-bin
    

top

Preferences

Go to system preferences and adjust the following:

  • Dock

    check "Automatically hide and show the Dock"

  • Mission Control

    uncheck "Automatically rearrange spaces based on most recent use"

    uncheck "When switching to an application, switch to a space with open windows for the application"

  • TimeMachine

    Exclude directories from TimeMachine backup

     sudo tmutil addexclusion -p ~/.dropbox
     sudo tmutil addexclusion -p ~/Dropbox
     sudo tmutil addexclusion -p ~/Google\ Drive/
     sudo tmutil addexclusion -p ~/Downloads/
     sudo tmutil addexclusion -p /usr/local/Cellar
     sudo tmutil addexclusion -p /usr/local/rvm
    
  • Language & Text

    select required input sources

  • Security & Privacy

    disable password reset through Apple ID

    turn on "File Vault"

    turn on Firewall

  • Keyboard

    in "Modifier Keys" popup switch "Caps Lock" to "Control"

    • Keyboard Shortcuts:

      • turn off "Show Spotlight Window" in spotlight group and

      • turn on "Select next source in Input menu" in the "Keyboard & Text" group.

      • turn on "Switch to Desktop .." in "Mission Control"

      • turn on "All controls" for full keyboard access at the bottom of the dialog.

  • Trackpad

    check "Tap to Click"

  • Mail, Contacts & Calendars

    Setup GMail account

  • Sharing

    Choose computer name

  • Accessability

    Enable dragging with Drag Lock on "Mouse & Trackpad/Trackpad Options"

top

All Descktops Apps

Change the following apps to be on all descktops:

  • Preferences
  • iTunes
  • Contacts
  • Calendar
  • Reminders
  • Skype
  • HipChat
  • 1Password
  • Activity Monitor

top

Homebrew

  • Install Xcode command line tools from Xcode Preferences' Downloads tab.
  • Install Xquartz of at least version 2.7.2

    NOTE: VERY important to install Xquartz before Homebrew.

  • Install Homebrew.
  • brew install macvim git wget imagemagick aria2 dos2unix watch tree pstree
  • brew install tmux mtr iftop htop-osx gpg2 ctags
  • brew install erlang
  • brew install clojure clojure-contrib leiningen
  • brew install md5deep ack s3cmd unrar
  • brew install tig

top

/etc git

sudo su -
cd /etc/
git init
chmod 700 .git
git add .
git commit -m initial

top

Postfix

UPDATE: I just installed a new Air laptop and it had the directories in the main.cf file pointing to the old location, so there was no need to do any of this... To check do grep data_directory /etc/postfix/main.cf. IF it points to /Library/... then you might need to do the fixes below.

If you upgraded from Lion your Postfix config is most probably broken. The upgrade changes /etc/postfix/main.cf to point to a new set of postfix directories but leaves the old directories at their old place.

Note: I expect ML upgrade process to be soon fixed to handle this so at some point in time those steps should become unnecessary

to verify the new directory locations:

ls /Library/Server/Mail/Data/spool
ls /Library/Server/Mail/Data/mta

check the old directory locations:

ls /var/spool/postfix
ls /var/lib/postfix

Lets move the directories to their new place (if needed):

sudo mkdir -p /Library/Server/Mail/Data
sudo mv /var/spool/postfix /Library/Server/Mail/Data/spool
sudo mv /var/lib/postfix /Library/Server/Mail/Data/mta

Start the Postfix daemon

sudo postfix set-permissions
sudo postfix start

set-permissions might complain about missing man pages. the problem is that the new postfix-files file has the man pages with .gz extension, but they were not compressed during the upgrade.

To fix:

d=/usr/share/man;grep manpage_directory /etc/postfix/postfix-files | cut -d/ -f2- | cut -d: -f1 | grep '\.gz$' | while read f; do echo $f;[ ! -e "$d/$f" -a -e "$d/${f%.gz}" ] && sudo gzip -9v "$d/${f%.gz}";done
sudo postfix set-permissions

Then you also might have the following problem:

postfix/postfix-script: warning: group or other writable: /Library/Server/Mail/Data/mta

To fix edit /etc/postfix/postfix-files:

sudo vim /etc/postfix/postfix-files

find the line

$data_directory:d:$mail_owner:-:770:uc

and change 770 to 750. then set-persmissions again and verify:

sudo postfix set-permissions
sudo postfix check

top

ZSH

brew install zsh zsh-completions

git clone git@github.com:astrails/dotzsh .zsh
ln -sfn .zsh/zshrc .zshrc

echo /usr/local/bin/zsh | sudo tee -a /etc/shells
chsh -s /usr/local/bin/zsh

# edit /etc/paths and move /usr/local/bin to the 1st line
# also add /usr/local/sbin just as the 2nd line
vim /etc/paths

top

top

Dot files

Fork http://github.com/astrails/dotfiles and make changes to suite your needs. You must edit user-gitconfig.

Then:

cd ~
git clone YOUR_FORK_LOCATION .dot
cd .dot
make install

This will install the following:

  • ~/.local-after.vim
  • ~/.zsh/local
  • /etc/gitconfig
  • ~/.gitconfig

top

Gitconfig

Homebrew's git system file is not quite properly set. it points to version install dir and not to /usr/local/etc. we will need to link it every git install/upgrade:

First note the path of the system gitconfig file:

git config --system -l

Link to /etc (use the path from previous command). e.g.:

# for older versions of git this will be something like
sudo ln -sfn /etc/gitconfig /usr/local/Cellar/git/1.7.11.4/etc/

# for the newer ones:
sudo ln -sfn /etc/gitconfig /usr/local/etc/

Verify it works:

git lga

NOTE: in older versions of brew git system config directory was inside the brew's Cellar, so you had to re-do this every time you installed a new version of git. The latest versions though, use /usr/local/etc/gitconfig instead, so you only need to do it once.

top

SSH

Copy your ~/.ssh directory over from the old system or backup.

SSH (new system / user)

Generate ssh keys:

ssh-keygen -t dsa

top

Dotvim

cd ~
git clone https://github.com/astrails/dotvim.git .vim
ln -sfn .vim/vimrc .vimrc

cd .vim
make install

top

RVM

curl -L https://get.rvm.io | sudo bash -s stable

After the install go to Preferences and add your user to the rvm group. Logout and re-login. now you are able to run rvm commands.

brew install libksba

rvm install ruby

brew tap homebrew/dupes
brew install apple-gcc42

rvm install 1.9.2

CFLAGS="-I/opt/X11/include" rvm install 1.8.7

top

Heroku

Copy ~/.heroku/accounts from the old machine.

Then:

gem install heroku
heroku plugins:install git://github.com/ddollar/heroku-accounts.git

Verify by running

heroku accounts

top

Nodejs

We will use NVM to install node:

cd ~
git clone git://github.com/creationix/nvm.git .nvm

Open new terminal so that nvm config will load (handled by dotfiles/zsh-local).

Then:

nvm install v0.8.6
nvm alias default v0.8.6

Open new terminal again and verify that node works.

Now we need to install a couple of npm modules:

npm install -g coffee-script
npm install -g js2coffee

top

POW

curl get.pow.cx | sh

top

Backblaze

Download and install Backblaze from backblaze.com.

Start backblaze.

Select Transfer Backup State from the Backblaze Menu Icon and follow the steps.

Time Machine

Its important to add backblaze directory to timemachine exclusions list

sudo tmutil addexclusion -p /Library/Backblaze.bzpkg

top

ScanSnap

  • Download ScanSnap Manager

    Need to install original software and latest update.

top

Copyright

© 2012 Vitaly Kushner, Astrails Ltd.

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