Skip to content

Instantly share code, notes, and snippets.

@ellerbrock
Forked from marcuslilja/clean-osx-install.md
Created July 26, 2017 15:25
Show Gist options
  • Save ellerbrock/cfae6960766a39e32b955e0dbef6e397 to your computer and use it in GitHub Desktop.
Save ellerbrock/cfae6960766a39e32b955e0dbef6e397 to your computer and use it in GitHub Desktop.
Clean Install – macOS Sierra (10.12)

macOS Sierra (10.12)

To be able to install all applications. We need to unlock the "Anywhere" setting in Gatekeeper.

sudo spctl --master-disable

Applications

A simple list of regular applications and plugins.

Regular downloads

App Store downloads

Browser plugins

Terminal setup

Be sure to download and install iTerm2 before you continue.

Installing Zsh (Oh My Zsh)

Start installation

curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

The installation will promt for Xcode Command Line Utilities to be installed. If the installation fails, run the command above again when Xcode Command Line Utilities has finished installing.

Create public key for Github

Create public key (use default storage)

ssh-keygen -t rsa -C "[email protected]"

Add public key

ssh-add ~/.ssh/id_rsa

Copy ssh key to Github

cat ~/.ssh/id_rsa.pub

Test connection to Github

ssh -T [email protected]

Install Pure theme

Clone repository to home directory

git clone [email protected]:sindresorhus/pure.git ~/.zsh-themes/pure

Create site-functions folder

sudo mkdir -p /usr/local/share/zsh/site-functions

Create symlinks for Pure

sudo ln -s ~/.zsh-themes/pure/pure.zsh /usr/local/share/zsh/site-functions/prompt_pure_setup
sudo ln -s ~/.zsh-themes/pure/async.zsh /usr/local/share/zsh/site-functions/async

Fix permissions for site-functions

sudo chown -R <username>:admin /usr/local/share

Create symlinks for Oh My Zsh

ln -s ~/.zsh-themes/pure/pure.zsh ~/.oh-my-zsh/custom/pure.zsh-theme
ln -s ~/.zsh-themes/pure/async.zsh ~/.oh-my-zsh/custom/async.zsh

Edit ~/.zshrc and set Pure as your theme

ZSH_THEME="pure"

Restart iTerm2.

Install Snazzy theme

Right-click and install Snazzy.itermcolors.

Activate ZSH auto-complete functions

For some autocomplete niceness update ~/.zshrc with:

plugins=(git github brew nvm npm node composer)

Enable jump forwards/backwards with alt + arrow

Add backwards jumping

Keyboard Shortcut: ⌥←
Action: Send Escape Sequence
Esc+: b

Add forwards jumping

Keyboard Shortcut: ⌥→
Action: Send Escape Sequence
Esc+: f

Installing Sublime Text 3

Install Package Manager

Install package manager with cmd + p and selecting Install packagemanager.

  • Install Material Theme with package manager
  • Install Oceanic Next Color Scheme with package manager

Add Sublime Text CLI

Add /usr/local/bin folder

sudo mkdir -p /usr/local/bin

Add alias for subl.

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Some great packages

  • Emmet
  • Babel
  • Stylus
  • DotENV
  • Pretty JSON
  • EditorConfig
  • AdvancedNewFile
  • MarkdownEditing
  • SidebarEnhancements
  • Laravel Blade Highlighter
  • Unicode Character Highlighter

Installing Homebrew

Start installation

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

Opt out from analytics

brew analytics off

Install some needed packages

brew install git ack wget curl gdbm gcc

OS X Preferences

UI tweaks and enhancements

Some of my own UI preferences for and some general enhancements for OS X. Pick the ones you like.

# Fix fonth smoothing
defaults -currentHost write -globalDomain AppleFontSmoothing -int 0

# Enable repeat on keydown
defaults write -g ApplePressAndHoldEnabled -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

# Switch Finder to use list mode
defaults write com.apple.Finder FXPreferredViewStyle Nlsv

# Show all filename extensions in Finder
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true

# Menu bar: disable transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true

# Set sidebar icon size to small
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1

# Disable “natural” (Lion-style) scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

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

# Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true

# Enable full keyboard access for all controls
# (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3

# Hide icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false

# Disable ext change warning
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# Disable sound effect when changing volume 
defaults write -g com.apple.sound.beep.feedback -integer 0

# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

# Set the icon size of Dock items to 26 pixels
defaults write com.apple.dock tilesize -int 26

# Trackpad: disable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool false
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 0
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 0

# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

# Disable drop shadows from screenshots
defaults write com.apple.screencapture disable-shadow -bool true

# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true

# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 15

More options in: https://github.com/mathiasbynens/dotfiles/blob/master/.macos

Remove NBSP for ALT + SPACE

By default alt + space in OS X would result in a no breaking space. This results in all kinds of weird behaviours when writing code. The best solution is to override alt + space and instead return a normal space.

Create path

mkdir -p ~/Library/KeyBindings

Create file

pico ~/Library/KeyBindings/DefaultKeyBinding.dict

Paste the following

{ "~ " = (insertText:, " ");

Save and exit.

GIT Settings

Add SSH key

ssh-add ~/.ssh/id_rsa

Basic GIT settings

git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global github.user username

git config --global core.editor "subl -w"
git config --global color.ui true
git config --global push.default simple

Installing Node with NVM

Install NVM

brew install nvm

Create NVM folder

mkdir ~/.nvm

Add the following to your ~/.zshrc file

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

Install a node version

nvm install <version>

Set installed version to default

nvm alias default <version>

Installing Yarn

Install yarn

brew install yarn

Installing Redis

Install Redis

brew install redis

Start redis at startup

brew services start redis

Installing Memcached

Install Memcached

brew install memcached

Start Memcached at startup

brew services start memcached

Installing PHP

Tap some brews

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/php

Install PHP

brew install php71 --with-fpm --without-apache

Load PHP with Zsh in ~/.zshrc

export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"

Install some plugins

brew install php71-mcrypt php71-imagick

Reinstall imagick

brew reinstall -s php71-imagick

Update default config values in /usr/local/etc/php/7.1/php.ini

date.timezone = Europe/Stockholm
upload_max_filesize = 64M
post_max_size = 32M

Install composer and envoy

Start installation

brew install composer envoy

Installing MySQL

Start installation

brew install mysql

Start MySQL on startup

brew services start mysql

Setup password and configure MySQL

/usr/local/opt/mysql/bin/mysql_secure_installation

Installing Heroku CLI

Start installation

brew install heroku

Installing PostgreSQL

Start installation

brew install postgresql

Start PostgreSQL on startup

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