ericrasch
11/25/2013 - 3:18 PM

Set up OSX 10.X

Set up OSX 10.X

Mac OS X App List

Tools

  • Bitly (custom link share tool)
  • ST2 (text editor for markup/code)

Homebrew install (see Brewfile)

Web Tools

Media Players

[apply]
    whitespace = fix
[color]
	# Use colors in Git commands that are capable of colored output when outputting to the terminal
	ui = auto
[color "branch"]
	current = yellow reverse
	local = yellow
	remote = green
[color "diff"]
	meta = yellow bold
	frag = magenta bold
	old = red bold
	new = green bold
	whitespace = white reverse
[color "status"]
	added = yellow
	changed = green
	untracked = cyan
	branch = magenta
	
[url "git://github.com/"]
    insteadOf = "github:"
[url "git@github.com:"]
    insteadOf = "gh:"
    pushInsteadOf = "github:"
    pushInsteadOf = "git://github.com/"
[url "git@github.com:germanny/"]
    insteadOf = "germanny:"
    
[push]
	default = matching
 
[merge]
	# Include summaries of merged commits in newly created merge commit messages
	log = true
 
[mergetool]
	keepBackup = true
 
[mergetool "diffmerge"]
	cmd = diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"
	trustExitCode = true
 
[diff]
	tool = diffmerge
 
[difftool "diffmerge"]
	cmd = diffmerge $LOCAL $REMOTE
	
[core]
    excludesfile = ~/.gitignore_global
    editor = /usr/bin/sublimetext
cask_args appdir: '/Applications'

#
# 1 taps
#

# homebrew dupes
tap 'homebrew/dupes'

# homebrew versions
tap 'homebrew/versions'

# homebrew php
# https://developerjack.com/blog/2016/installing-php71-with-homebrew/
tap 'homebrew/homebrew-php'

# caskroom versions
tap 'caskroom/versions'



#
# 2 casks
# GUI Mac applications (free/trials)
#


#https://agilebits.com/onepassword
cask '1password'

#http://www.alfredapp.com/
cask 'alfred2'

#http://www.macbartender.com/
cask 'bartender'

#http://lightheadsw.com/caffeine/
cask 'caffeine'

#http://macpaw.com/cleanmymac
cask 'cleanmymac'

#http://sourcegear.com/diffmerge/
cask 'diffmerge'

#https://www.dropbox.com/
cask 'dropbox'

#https://evernote.com/
cask 'evernote'

#http://www.mozilla.org/en-US/firefox/new/
cask 'firefox'

#http://justgetflux.com/
cask 'flux'

#https://www.google.com/intl/en/chrome/browser/
cask 'google-chrome'

#https://tools.google.com/dlpage/drive
cask 'google-drive'

#http://handbrake.fr/
cask 'handbrake'

#http://imageoptim.com/
cask 'imageoptim'

#http://iterm.sourceforge.net/
cask 'iterm2'

#http://screenhero.com/
cask 'screenhero'

#http://www.sequelpro.com/
cask 'sequel-pro'

#http://www.bohemiancoding.com/sketch/
cask 'sketch'

#https://evernote.com/skitch/
cask 'skitch'

#https://slack.com/downloads/osx
cask 'slack'

#http://spectacleapp.com/
cask 'spectacle'

#https://www.sublimetext.com/
cask 'sublime-text'

#http://smilesoftware.com/TextExpander/index.html
cask 'textexpander'

#http://www.git-tower.com/
cask 'tower'

#http://panic.com/transmit/
cask 'transmit'

#http://www.vagrantup.com/
cask 'vagrant'

#http://vagrantmanager.com/
cask 'vagrant-manager'

#https://www.virtualbox.org/
cask 'virtualbox'

#http://www.videolan.org/vlc/index.html
cask 'vlc'

#http://iconfactory.com/software/xscope
cask 'xscope'



#
# 3 editor / pager
#

brew 'vim'



#
# 4 programming environment
#

#brew 'apple-gcc42
#brew 'autoconf
#brew 'automake
#brew 'gettext
#brew 'intltool



#
# 5 programming languages
#

# clojure
#brew 'leiningen'

# erlang
#brew 'erlang'
#brew 'elixir'
#brew 'rebar'

# go
#brew 'go'

# groovy
#brew 'groovy'

# haskell
#brew 'haskell-platform'

# lua
#brew 'lua'

# mono (.net)
# https://gist.github.com/shtirlic/4696903

# node
#brew 'node'

# ocaml
#brew 'ocaml'

# php
# https://developerjack.com/blog/2016/installing-php71-with-homebrew/
brew 'php71'

# python
brew 'python'

# ruby
#brew 'chruby'

#brew 'ruby-install'

# rust
#brew 'rust'

# scala
#brew 'scala'



#
# 6 networking
#

brew 'fping'
#brew 'netcat'
#brew 'ngrep'
#brew 'nmap'
#brew 'stunnel'
#brew 'tcpdump'



#
# 7 vcs
#

brew 'git'
#brew 'mercurial'



#
# 8 web browsers
#

# finally this has been bottled
#brew 'phantomjs'



#
# 9 databases
#

#brew 'redis'
#brew 'riak'
brew 'sqlite3'



#
# 10 utilities
#

brew 'ansible'
#brew 'ag'
brew 'cdrtools'
#brew 'ctags'
brew 'imagemagick'
brew 'jpeg'
#brew 'lnav'
#brew 'pcre'
#brew 'reattach-to-user-namespace'
brew 'terminal-notifier'
#brew 'tmux'
brew 'tree'
#brew 'watch'
brew 'wget'

# https://yarnpkg.com/en/docs/install#mac-tab
# brew install yarn --without-node
brew 'yarn', args: ["without-node"]

# irc / instant message
#brew 'bitlbee'
#brew 'znc'

#
# 11 Mac App Store apps
#

mas "Kindle", id: 405399194
mas "Pages", id: 409201541
mas "Spark", id: 1176895641
mas "Patterns", id: 429449079
mas "Bear", id: 1091189122
mas "Numbers", id: 409203825

Setup OSX 10.X with a Clean Install

About once a year, my machine gets pretty sluggish and it's time to start fresh. Here's the process I use to update it with everything I need.

1. Start with a Fresh Install of OS X

  • Back up all photos, music, apps, iTunes library, keychains, etc.
  • Deauthorize iTunes and Photoshop.
  • Deactivate CleanMyMac 3 license.
  • 1Password, Dropbox, Evenote sync
  • Update Brewfile (below) with these:
    • Get a list of currently install brew packages: brew list
    • Get a list of currently installed brew casks: brew cask list
    • Get a list of installed App Store apps: mas list
  • Get a list of NPM packages: npm list -g --depth=0
  • Copy settings/preferences for any other apps in a safe place (ST3/Atom, Adobe apps, TextExpander/keyboard shortcuts, FTP favorites, email account info, app licenses/serials, browser bookmarks, etc. etc. etc.)

When you're ready to take the plunge:

  • Restart your Mac from the Apple menu and hold down Cmd+R as soon as the reboot starts
  • Click on Disk Utility then Continue first of all to get your Mac's hard drive wiped. Select your startup drive on the left (typically Macintosh HD), switch to the Erase tab and choose Mac OS Extended (Journaled) from the Format drop-down menu. Select Erase and then confirm your choice.
  • Quit out of the Disk Utility app, and this time choose Reinstall OS X and Continue. Follow the instructions that appear on screen, license agreements and all, and choose the hard drive to use (in most cases it'll be the only one available). Along the way you can sign in with your Apple credentials to get your apps and iCloud links back again.

2. Install XCode and Command Line Tools

  • Open the App Store and search for XCode
  • Open XCode after it finishes installing and accept the "Terms of Service"
  • Command Line Tools is a separate download

3. Reset some OSX Preferences

# Show hidden files
defaults write com.apple.finder AppleShowAllFiles -boolean true
killall Finder

# Show the ~/Library folder
chflags nohidden ~/Library

# Show Path bar in Finder
defaults write com.apple.finder ShowPathbar -bool true

# Show Status bar in Finder
defaults write com.apple.finder ShowStatusBar -bool true

# Show absolute path in finder's title bar. 
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

# Change screenshots from PNG to JPG
defaults write com.apple.screencapture type jpg
killall SystemUIServer

# Symlink directories with parentheses
# https://stackoverflow.com/a/39029259
# cd to your home folder and create a symlink of the directory that has the parentheses:
ln -s '/Users/username/Dropbox (Personal)/' DropboxPersonal

# Specify a directory for screenshots
# https://twitter.com/sarah_edo/status/802545188279197696
# Use symlink created above if directory has parentheses
defaults write come.apple.screencapture location ~/screenshot-directory-path
killall SystemUIServer

# Disable Gatekeeper in macOS Sierra
# https://www.tekrevue.com/tip/gatekeeper-macos-sierra/
sudo spctl --master-disable
# Enable Gatekeep in macOS Sierra
sudo spctl --master-enable

Other commands for preferences here.

4. Configure Git and Generate SSH keys for GitHub

Copy the attached gitconfig settings and set your user info (left out to avoid issues). Then, enable Git password caching

bash
cd ~/ && curl -O https://gist.githubusercontent.com/germanny/7642823/raw/2856041e6d284048cb2092bfb10ddc9a76528fa4/my_gitconfig.md
git config --global user.name "Your Name Here"
git config --global user.email youremail@example.com
git config --global credential.helper osxkeychain

Visit GitHub's official guide for instructions.

Be sure to set proper permissions for your /home/<user>, ~/.ssh, and ~/.ssh/authorized_keys, or you'll get a "Permission denied (publickey)." error:

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

5. Clone and Install Bash-It

Visit the Bash-It repo for more details.

Chruby is required for the rest of the setup, be sure to enable it when setting up Bash-It plugins

git clone git@github.com:Bash-it/bash-it.git

-or-

git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
~/.bash_it/install.sh

Open a new terminal window to use the Bash-It options you've set

6. Clone and Install Homebrew

Many apps can be installed through Homebrew which makes the process way simpler. This includes Homebrew-Cask now.

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

7. Install a Brewfile

1. Install Homebrew Bundle

brew tap homebrew/bundle

2. Install mas-cli

This is a simple command line interface for the Mac App Store.

brew install mas

3. Clone and install my Brewfile

Be sure to update it first with your own preferred packages, casks, apps, etc.

git clone --depth=1 https://gist.githubusercontent.com/germanny/7642823/raw/7b1b234b7942b2dc6448e65687ef9084f7adda3c/my_Brewfile
brew bundle

8. Install Node sans NPM, and then NPM separately:

https://gist.github.com/DanHerbert/9520689.

For more info, visit https://johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/

To install various versions of Node via Homebrew: http://apple.stackexchange.com/a/207883.

9. Install Node Version Manager:

https://github.com/creationix/nvm.

10. Install Ruby properly:

11. Install Composer:

https://getcomposer.org/doc/00-intro.md#globally

PATH update below.

12. Powerline for Bash:

https://github.com/riobard/bash-powerline

13. Update PATH

These are the last few lines of my .bash_profile:

# Load Bash It
source $BASH_IT/bash_it.sh

# Point to location of npm-packages
export PATH="$HOME/.npm-packages/bin:$PATH"

# bash-powerline
source ~/.bash-powerline.sh

# Add local bin and local sbin ahead of $PATH
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"

# Initialize rbenv
#if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

# Add composer
export PATH="$PATH:$HOME/.composer/vendor/bin"

# Persist SSH Key across reboots
ssh-add -A 2>/dev/null;

# Create an alias like be or bex or similar to make life easier
alias bex="bundle exec"
alias proddeploy="bundle exec cap production deploy"
alias stagdeploy="bundle exec cap staging deploy"
alias nbb-install="rm -rf node_modules/ &&  rm -rf bower_components/ && npm install && bower install && bundle install"
alias bb-install="rm -rf bower_components/ && bower install && bundle install"
alias phpw="open http://localhost:8000 && php -S localhost:8000"
alias dnsflush="sudo dscacheutil -flushcache"

14. Install Color Schemes

My current preferred color scheme: https://draculatheme.com/

My previous color scheme:

Terminal

cd ~/ && curl -O https://raw.githubusercontent.com/germanny/OSX-Terminal-Monokai-Dark-Theme/master/Monokai%20Dark.terminal && open ./Monokai%20Dark.terminal

Open Terminal > Preferences (or CMD + ,) and select "Default" to make your new theme the default theme

ST3

My preferred version of Monokai Extended Bright

Material Theme

Visit @jimmynotjim's OSX Phix Theme repo for more details.

cd ~/ && curl -O https://gist.githubusercontent.com/mvaneijgen/4c56701215847dd5ddcf/raw/d78a58ac38197f3b46afc38617e31a07f39370d2/material-theme.terminal && open ./material-theme.terminal

15. Install Global Node Packages

npm install -g yo bower gulp

16. Configure Sublime Text

Install Package Manager

Add subl command

To map SublimeText to open files from the command line, add the subl command. If you don't have a ~/bin in your home directory, follow this.

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

Settings

See my Package Control User Settings. See my ST User Preferences.

Add Open with Sublime Text service:

http://charles.lescampeurs.org/2012/06/18/right-click-open-with-sublime-text-2

More information: https://gist.github.com/ericrasch/9e20e18b2e91a01ee328

17. Install Alfred Workflows

Can use Alfred Workflow Searcher to get many of these.

18. Set NPM user

npm adduser username

19. Download a base Ubuntu box for Vagrant for local development:

Ubuntu 12.04 LTS 64-bits

vagrant box add precise64 http://files.vagrantup.com/precise64.box

20. Configure Environment for Genesis or Evolution

You need all these:

These were installed in your Brewfile:

npm install -global yo bower generator-genesis-wordpress git-open
vagrant plugin install vagrant-hostmanager
vagrant plugin install vagrant-list
curl https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub >> ~/.ssh/authorized_keys
gem install capistrano -v 2.15.3
gem install capistrano-ext colored

If you get EMFILE issues, try running: $ ulimit -n 4096.

(You can check your versions by running node --version, npm --version, etc.)

Then, install Capistrano v2.15.* via Bundler & Ansible:

$ sudo bundle install
$ sudo easy_install pip
$ sudo pip install ansible

All done, have fun!

This process has been borrowed from here, here, here, here, here, here, and of course, here.

{
    "added_words":
    [
        "Mockup",
        "plugins",
        "coffeescript",
        "sourcemaps",
        "html",
        "plugin",
        "init",
        "gulpfile",
        "Transpiling",
        "transpile",
        "imagemin",
        "Templating",
        "templating",
        "gulpfiles",
        "js",
        "json",
        "npm",
        "css",
        "streamify",
        "linting",
        "src",
        "dest",
        "Transpilers",
        "Autoprefixers",
        "Autoprefixer",
        "styl",
        "app",
        "autoprefixer",
        "→",
        "dev",
        "uglify",
        "cssnext",
        "postcss",
        "uglifying",
        "javascript",
        "Github",
        "Powershell",
        "colour",
        "colours",
        "concat",
        "online",
        "workflow",
        "workflows"
    ],
    "afn_insert_dimensions": false,
    "always_show_minimap_viewport": true,
    "auto_complete": true,
    "auto_complete_selector": "source, text",
    "auto_indent": true,
    "binary_file_patterns":
    [
        ".DS_Store",
        "tmp/",
        "*.png",
        "*.psd",
        "*.ai",
        "tmp/",
        "_tmp/"
    ],
    "bold_folder_labels": true,
    "caret_extra_bottom": 2,
    "caret_extra_top": 2,
    "caret_extra_width": 1,
    "caret_style": "solid",
    "close_windows_when_empty": true,
    "color_scheme": "Packages/User/SublimeLinter/Dracula (SL).tmTheme",
    "detect_indentation": true,
    "draw_centered": false,
    "draw_minimap_border": true,
    "draw_white_space": "selection",
    "enable_tab_scrolling": false,
    "ensure_newline_at_eof_on_save": true,
    "extend_env":
    {
        "PATH": "/usr/local/bin"
    },
    "fade_fold_buttons": false,
    "file_exclude_patterns":
    [
        ".DS_Store",
        "dump.rdb"
    ],
    "find_selected_text": true,
    "folder_exclude_patterns":
    [
        ".git",
        ".awestruct",
        ".sass-cache",
        "_developer-materials",
        "_downloads",
        "_tmp",
        "_specs",
        "_site",
        "_products",
        "_projects",
        ".hg",
        "bower_components",
        "CVS",
        "cache",
        "vendor",
        "logs",
        "log",
        "node_modules",
        ".sass-cache",
        "tmp"
    ],
    "font_face": "OperatorMono-Book",
    "font_options":
    [
        "subpixel_antialias"
    ],
    "font_size": 14.0,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "ignored_packages":
    [
        "Vintage",
        "Vintageous"
    ],
    "indent_guide_options":
    [
        "draw_normal",
        "draw_active"
    ],
    "index_exclude_patterns":
    [
        "*.log"
    ],
    "line_padding_bottom": 1,
    "line_padding_top": 1,
    "margin": 4,
    "match_brackets": true,
    "match_brackets_angle": true,
    "match_brackets_braces": true,
    "match_brackets_content": true,
    "match_brackets_square": true,
    "origami_auto_zoom_on_focus": false,
    "overlay_scroll_bars": "enabled",
    "scroll_past_end": true,
    "show_encoding": true,
    "show_full_path": true,
    "show_line_endings": true,
    "soda_classic_tabs": true,
    "soda_folder_icons": true,
    "spell_check": true,
    "tab_size": 2,
    "translate_tabs_to_spaces": true,
    "trim_automatic_white_space": true,
    "trim_trailing_white_space_on_save": true,
    "use_simple_full_screen": false,
    "use_tab_stops": true,
    "wide_caret": true,
    "word_wrap": true
}
{
    "bootstrapped": true,
    "in_process_packages":
    [
    ],
    "installed_packages":
    [
        "Alignment",
        "DocBlockr",
        "Dracula Color Scheme",
        "GitGutter",
        "HTML5",
        "jQuery",
        "Markdown Extended",
        "Package Control",
        "SublimeLinter",
        "SublimeLinter-contrib-sass-lint",
        "SublimeLinter-jshint",
        "SublimeLinter-phpcs",
        "Syntax Highlighting for Sass",
        "WordPress"
    ]
}