Skip to content

Instantly share code, notes, and snippets.

@devdetonator
Forked from marcuslilja/clean-osx-install.md
Created July 20, 2016 13:11
Show Gist options
  • Save devdetonator/9c20ba0d1e856afcd3a6ee6e39847c9e to your computer and use it in GitHub Desktop.
Save devdetonator/9c20ba0d1e856afcd3a6ee6e39847c9e to your computer and use it in GitHub Desktop.
Clean Install – OS X 10.11 El Capitan

Mac OS X 10.11 (El Capitan)

Some text to describe it all here.

Applications

A simple list of regular applications and plugins.

Regular downloads

App Store downloads

Browser plugins

Sublime Text

Add Sublime Text CLI

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 custom shell

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration. To learn more visit ohmyzsh.sh.

Switching to Oh My Zsh

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

Install doubleend theme

First download doubleend theme.

Put the downloaded theme file in ~/.oh-my-zsh/themes/doubleend.zsh-theme. To activate doubleend theme update ~/.zshrc with:

ZSH_THEME="doubleend"

Better typeface and color theme

For some additional niceness download inconsolata font and solarized theme.

Activate ZSH auto-complete functions

For some autocomplete niceness update ~/.zshrc with:

plugins=(git osx github node npm ruby gem brew composer bower)

Custom ZSH PHP Server functions

These are not required, but provides a nice abstraction for PHP development server. The server defaults to port 8000, but can easily be overridden.

Laravel projects

Run projects with serve <port>.

serve() {
  PORT=8000

  if [ ! -z $1 ]; then
    PORT=$1
  fi

  php artisan serve --host=0.0.0.0 --port="$PORT" --env=local;
}

Regular PHP Projects

Run projects with server <folder> <port> or server <port>. If the first argument is a string it will be used as <folder> otherwise it will be used as <port>.

server() {
  DOCUMENT_ROOT=""
  PORT=8000

  if [ ! -z $1 ]; then
    if [ $1 -eq $1 ] 2>/dev/null; then
      PORT=$1
    else
      DOCUMENT_ROOT=$1
    fi
  fi

  if [ ! -z $2 ]; then
    DOCUMENT_ROOT=$2
  fi

  if [ ! -z $DOCUMENT_ROOT ]; then
    php -S 0.0.0.0:"$PORT" -t $DOCUMENT_ROOT
  else
    php -S 0.0.0.0:"$PORT"
  fi
}

Custom ZSH-config alias

Remembering shell-config is easier than remembering subl ~/.zshrc.

alias shell-config="subl ~/.zshrc"

Installing Xcode Command Line Tools

Command Line Tools for Xcode is required to get homebrew working. Minimum effort to install them is to run xcode-select --install. However, it is nice to install Xcode for iOS device testing as well.

Homebrew

Homebrew — The missing package manager for OS X.

Install homebrew

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

Some nice packages

brew install git ack wget curl gdbm gcc

OS X Preferences

Set hostname

A custom hostname is funnier than "Your Name's Macbook".

sudo scutil --set HostName "<hostname>"

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

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

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 ~/Library/KeyBindings/DefaultKeyBinding.dict
  • Insert { "~ " = (insertText:, " "); } into the newly created file

Enable CTRL + TAB in terminal

  1. Open System Preferences => Keyboard
  2. Go to Keyboard Shortcuts
  3. Click on "Application Shortcuts" on the left
  4. Click the little "+" to add a program
  5. Navigate to Terminal (it's hidden in Applications/Utilities)
  6. For the Menu Title type "Show Next Tab" or "Show Previous Tab"
  7. For the Keyboard Shortcut type Ctrl-Tab or Ctrl-Shift-Tab

GIT

Basic setup for GIT.

Setup Github

ssh-keygen -t rsa -C "user.name@mail.com"
ssh-add id_rsa

# Copy ssh key to github.com
subl ~/.ssh/id_rsa.pub

# Test connection
ssh -T git@github.com

# Set git config values
git config --global user.name "Your Name"
git config --global user.email "user.name@gmail.com"
git config --global github.user username
git config --global github.token your_token_here

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

# Set git default mergetool
git config --global merge.tool opendiff

Memcached

Install Memcached with homebrew.

brew install memcached

Start Memcached now and on restart

brew services start memcached

PHP

Install PHP 7.0

More information about installing PHP can be found at josegonzalez/homebrew-php.

# Tap into brews
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php

# Install PHP with FPM
brew install php70 --with-fpm --without-apache

# Install extensions
brew install php70-mcrypt php70-imagick

# Update default config values in /usr/local/etc/php/7.0/php.ini
date.timezone = Europe/Stockholm
upload_max_filesize = 64M
post_max_size = 32M

Install Composer and Envoy

brew install composer envoy

MySQL

Install MySQL 5.7.x

brew install mysql
mysql.server start
# Secure MySQL
/usr/local/opt/mysql/bin/mysql_secure_installation

Node

Install node with brew

brew install node

Alfred

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