Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wechain
Forked from germanny/_instructions.md
Created August 10, 2018 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wechain/19de7025172774828fc41883dd15d863 to your computer and use it in GitHub Desktop.
Save wechain/19de7025172774828fc41883dd15d863 to your computer and use it in GitHub Desktop.
Instructions for setting up OSX 10.X.X

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.

  • 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

This may be needed to run vagrant machines and yo.

  • 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

# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# 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

# 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

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

# 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

# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0

# 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; update [YOUR GITHUB USERNAME] in .gitconfig before using!). Then, enable Git password caching

bash
cd ~/ && curl -O https://gist.githubusercontent.com/germanny/7642823/raw/e1000fc4363cd9ac67e958da17563c86ca71d263/my_gitconfig
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 Brew-It

Many apps can be installed through Homebrew, homebrew-cask, and mas-cli which makes the process way simpler

Visit my Brew-It repo for more details.

git clone git@github.com:germanny/brew-it.git ~/.brew_it
~/.brew_it/install.sh
brew update
brew upgrade

This will 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)"

If that fails, these were the older instructions:

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.github.com/germanny/b39c97a3eb6659ca64ede0e07fef1cbf
brew bundle

7. Set up Ruby

Add eval "$(rbenv init -)" to your .bash_profile and run the rbenv-doctor script

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

If everything is working fine, set up your preferred version of Ruby and install Bundler.

rbenv install 2.5.0
rbenv global 2.5.0
gem install bundler

If the above fails, these were the old instructions:

Install Ruby properly:

8. Update PATH

Open .bash_profile and make the following edits

  • Add local bin and local sbin ahead of $PATH /usr/local/bin:/usr/local/sbin:

9. Install Node and Global Packages

As part of the brew installation nvm should have been installed. It requires a bit of manual setup.

Create NVM's working directory if it doesn't exist:

mkdir ~/.nvm

Add the following to ~/.bash_profile:

export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"

Install your prefered version of node

nvm install 9

Install global packages

npm install -g yo bower gulp bundler generator-evolve generator-genesis-wordpress generator-evolve git-open grunt-cli node-gyp sass-lint

If the above fails, these were the old instructions:

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.

Install Node Version Manager:

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

10. Install Composer:

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

PATH update below.

11. Powerline for Bash:

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

12. Final PATH Updates:

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 nbbc-install="rm -rf node_modules/ && rm -rf bower_components/ && yarn install && bower install && composer update && bundle install"
alias phpw="open http://localhost:8000 && php -S localhost:8000"
alias dnsflush="sudo dscacheutil -flushcache"

13. 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. Configure Sublime Text

Set up PHP Code Sniffer

https://github.com/FriendsOfPHP/PHP-CS-Fixer#globally-homebrew http://benmatselby.github.io/sublime-phpcs/

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

16. Install Alfred Workflows

Can use Alfred Workflow Searcher to get many of these.

17. Set NPM user

npm adduser username

18. 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

19. Configure Environment for Genesis or Evolution

You need all these:

These should have been installed above:

These were installed in your Brewfile:

Install the remaining items to get the needed vagrant plugins and gems:

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

Or, install a specific version of ansible with sudo pip install 'ansible==2.0.0.1' as needed.

All done, have fun!

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

[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
[alias]
; show merge tree + commits info
graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
; basic logging for quick browsing
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
; log + file diff
fl = log -u
; find paths that matches the string
f = "!git ls-files | grep -i"
; delete all merged branches
; dm = !git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
; shortcuts
cp = cherry-pick
st = status -s
cl = clone
ci = commit
co = checkout
br = branch
dc = diff --cached

Mac OS X App List

Tools

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

Homebrew install (see Brewfile or Brew-It repo)

Web Tools

Media Players

Other suggested apps

From Eric Rasch: https://gist.github.com/ericrasch/44fd2c25b7126adbc61d

{ // It seems python/sublime cannot always find the php application // If empty, then use PATH version of php, else use the set value "phpcs_php_path": "/usr/bin/php",

// It seems python/sublime cannot always find the phpcs application
// If empty, then use PATH version of phpcs, else use the set value
"phpcs_executable_path": "/Users/germanny/.composer/vendor/bin/phpcs",

// Path to where you have the phpcbf installed
"phpcbf_executable_path": "/Users/germanny/.composer/vendor/bin/phpcbf",

// Path to where you have the php-cs-fixer installed
"php_cs_fixer_executable_path": "/usr/local/bin/php-cs-fixer",

"phpcs_show_quick_panel": false,

"php_cs_fixer_on_save": true,

"phpcbf_on_save": true

}

{
	"bootstrapped": true,
	"in_process_packages":
	[
	],
	"installed_packages":
	[
		"Agila Theme",
		"Alignment",
		"DocBlockr",
		"Dracula Color Scheme",
		"Emmet",
		"GitGutter",
		"HTML5",
		"jQuery",
		"JsPrettier",
		"Markdown Extended",
		"Package Control",
		"PackageResourceViewer",
		"Phpcs",
		"Sass",
		"SublimeLinter",
		"SublimeLinter-contrib-sass-lint",
		"SublimeLinter-jshint",
		"Theme - Dark Material",
		"WordPress"
	]
}
{
	"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": 16.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": 2,
	"line_padding_top": 2,
	"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,
	"theme": "Agila Dracula.sublime-theme",
	"theme_agila_compact_tab": true,
	"theme_agila_horizontal_scrollbar_thickest": true,
	"theme_agila_sidebar_font_xsmall": true,
	"theme_agila_sidebar_mini": true,
	"theme_agila_vertical_scrollbar_thickest": true,
	"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
}
```
{
"user":
{
"@disable": true,
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes":
[
],
"lint_mode": "save only",
"linters":
{
"jshint":
{
"@disable": false,
"args":
[
],
"excludes":
[
]
},
"phpcs":
{
"@disable": false,
"args":
[
],
"excludes":
[
],
"standard": "PSR2"
},
"sass":
{
"@disable": false,
"args":
[
],
"excludes":
[
]
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths":
{
"linux":
[
],
"osx":
[
],
"windows":
[
]
},
"python_paths":
{
"linux":
[
],
"osx":
[
],
"windows":
[
]
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map":
{
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"tooltip_fontsize": "1rem",
"tooltip_theme": "Packages/SublimeLinter/tooltip-themes/Inline/Inline.tooltip-theme",
"tooltip_theme_excludes":
[
],
"tooltips": true,
"warning_color": "DDB700",
"wrap_find": true
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment