Skip to content

Instantly share code, notes, and snippets.

@nunosans
Last active March 19, 2022 17:49
Show Gist options
  • Save nunosans/09bea75c960537ad31a1ecaffe488978 to your computer and use it in GitHub Desktop.
Save nunosans/09bea75c960537ad31a1ecaffe488978 to your computer and use it in GitHub Desktop.
Fresh macOS setup.

Install Development Tools

Install Xcode Development Tools

xcode-select --install

Setup the Xcode colour theme

  1. Download the Space Gray colour theme
  2. Set the typeface to SF Mono at 14 points
  3. Reduce the current line opacity to 12%.

Install Homebrew

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

Install CLI tools via Homebrew

brew install mas mysql node postgresql sqlite3 rbenv ruby-build zsh zsh-completions

Install Heroku CLI tools.

cd ~/Downloads

curl -O https://cli-assets.heroku.com/branches/stable/heroku-osx.pkg

open heroku-osx.pkg

heroku login

Setup ZSH. Finish by pasting the settings on the prefereces file

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

chsh -s /usr/local/bin/zsh

vim ~/.zshrc

# ZSH Settings.
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
export PS1="[%~]$ "
export ZSH=/Users/Nuno/.oh-my-zsh
export EDITOR=/usr/bin/vim
export VISUAL=/usr/bin/vim
ZSH_THEME="kolo"
plugins=(git osx)
source $ZSH/oh-my-zsh.sh

# Postgres Settings.
export PGHOST=localhost

# RVM Settings.
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH=$PATH:"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/mysql/bin:/opt/local/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

# Aliases.
alias ll="ls -laGH"
alias .="echo $PWD"
alias savant="ssh [email protected] -p 2226"
alias mmb="bundle exec middleman build"
alias mms="bundle exec middleman server"
alias fs="foreman start"
alias pgs="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start"
alias sass="sass --watch all.scss:all.css"
alias s="open -a 'Sublime Text.app'"
alias sublime="open -a 'Sublime Text.app'"
alias safari="open -a 'Safari.app'"
alias vhosts="sublime /etc/hosts /etc/apache2/users/Nuno.conf"
alias server="python -m SimpleHTTPServer 8001"

Setup Ruby

rbenv install 2.3.3

rbenv global 2.3.3

ruby -v

Setup Git

git config --global color.ui true

git config --global user.name "Nuno Coelho Santos"

git config --global user.email "[email protected]"

git config --global help.autocorrect 1

git config --global alias.s "status"

git config --global alias.c "commit"

git config --global alias.p "push"

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

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

cat ~/.ssh/id_rsa.pub (Paste public key to Github)

Install Rails

gem install rails -v 5.0.0.1

rbenv rehash

Setup MySQL

ln -sfv /usr/local/opt/mysql/*plist ~/Library/LaunchAgents

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Setup PostgreSQL

ln -sfv /usr/local/opt/postgresql/*plist ~/Library/LaunchAgents

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Install Applications

Install Mac Apps via Cask

  • Alfred
  • Bartender
  • ClipMenu
  • Dropbox
  • Figma
  • Firefox
  • Flinto
  • Fluid
  • Fontstand
  • Framer
  • Gitbox
  • Google Chrome
  • Google Drive
  • ImageOptim
  • iTerm 2
  • LICECap
  • Messenger
  • Mumble
  • Next Meeting
  • ngrok
  • OpenEmu
  • Origami Studio
  • Paw
  • PG Commander
  • Pixate Studio
  • Postgres
  • Principle
  • RightFont
  • Sequel Pro
  • SizeUp
  • Sketch
  • Sketch Toolbox
  • Skype
  • Slack
  • Spotify
  • Sublime Text
  • SuperDuper!
  • Things
  • Transmission
  • VirtualBox
  • VLC
  • WhatsApp
  • xScope
  • Zeplin

brew cask install alfred bartender clipmenu dropbox figma firefox flinto fluid fontstand framer gitbox google-chrome google-drive imageoptim iterm2 licecap messenger mumble next-meeting ngrok openemu origami-studio paw pg-commander pixate-studio postgres principle sequel-pro rightfont sizeup sketch sketch-toolbox skype slack spotify sublime-text superduper things transmission virtualbox vlc whatsapp xscope zeplin

Install Quicklook plugins.

brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webpquicklook suspicious-package

Sign in to Mac App Store and Install Mac App Store Apps

  • 1Password (443987910)
  • CleanMyDrive 2 (523620159)
  • Clocks (414554506)
  • CodeBox (412536790)
  • DaisyDisk (411643860)
  • Dash (458034879)
  • Encrypto (935235287)
  • Flycut (442160987)
  • Fontcase (403095673)
  • GarageBand (682658836)
  • Glyphs Mini (469036911)
  • iA Writer (775737590)
  • Keynote (409183694)
  • LittleIpsum (405772121)
  • LiveReload (482898991)
  • Micro Snitch (972028355)
  • MindNode Pro (402398561)
  • Next Meeting (1017470484)
  • PaintCode (507897570)
  • Permute (731738567)
  • Realm Browser (1007457278)
  • Remote Mouse (403195710)
  • Sip (507257563)
  • Soulver (413965349)
  • Telegram (747648890)
  • The Unarchiver (425424353)
  • Timer (827092122)
  • Transmit (403388562)
  • Tweetbot (557168941)
  • Xcode (497799835)

mas signin [email protected]

mas install 443987910 523620159 414554506 412536790 411643860 458034879 935235287 442160987 403095673 682658836 469036911 775737590 409183694 405772121 482898991 972028355 402398561 1017470484 507897570 731738567 1007457278 403195710 507257563 413965349 747648890 425424353 827092122 403388562 557168941 497799835

macOS Preferences

Disable transparency in the menu bar and elsewhere.

defaults write com.apple.universalaccess reduceTransparency -bool true

Expand save panel by default

defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true

defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true

Expand print panel by default

defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true

defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

Automatically quit printer app once the print jobs complete

defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true

Disable the “Are you sure you want to open this application?” dialog

defaults write com.apple.LaunchServices LSQuarantine -bool false

Remove duplicates in the “Open With” menu (also see lscleanup alias)

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Disable Resume system-wide

defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false

Disable the crash reporter

defaults write com.apple.CrashReporter DialogType -string "none"

Skip verifying disk images

defaults write com.apple.frameworks.diskimages skip-verify -bool true

defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true

defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true

Automatically open a new Finder window when a volume is mounted

defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true

defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true

defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true

Enable AirDrop over Ethernet and on unsupported Macs running Lion

defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true

Disable hibernation (speeds up entering sleep mode)

sudo pmset -a hibernatemode 0

Increase sound quality for Bluetooth headphones/headsets

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40

Always hide the Desktop

defaults write com.apple.finder CreateDesktop false; killall Finder

Make terminal logins fast

touch ~/.hushlogin

Disable most animations

defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

defaults write -g QLPanelAnimationDuration -float 0

defaults write NSGlobalDomain NSWindowResizeTime -float 0.001

defaults write com.apple.finder DisableAllAnimations -bool true

Increase the key repeat rate

defaults write NSGlobalDomain KeyRepeat -int 0

Save to disk (not to iCloud) by default

defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

Stop Finder from writing .DS_Store files on network volumes

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

Disable character substitution for dashes (i.e: -- replaced by —) even when character substitution is enabled

defaults write -g NSAutomaticDashSubstitutionEnabled 0

Disable the horrible character chooser popup, and get proper key repeat

defaults write -g ApplePressAndHoldEnabled -bool false

Show user Library

chflags nohidden ~/Library

Make Help use a regular window

defaults write com.apple.helpviewer DevMode -bool true

Disable Dashboard

defaults write com.apple.dashboard mcx-disabled -bool true

Set an Ultra-Fast Dock Hide & Display Animation

defaults write com.apple.dock autohide-time-modifier -float 0.12;killall Dock

Prevent your MacBook from booting after opening the lid (factory setting =%03)

sudo nvram AutoBoot=%00

Avoid creating .DS_Store files on network or USB volumes

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

Sublime Text Preferences

Install Package Control via the console

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Set User Preferences

{
  "auto_complete": true,
  "color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
  "create_window_at_startup": false,
  "dictionary": "Packages/Language - English/en_US.dic",
  "ensure_newline_at_eof_on_save": true,
  "file_exclude_patterns":
  [
    ".DS_Store",
    "*.sublime-project",
    "*.sublime-workspace",
    ".keep",
    "*.pyc"
  ],
  "folder_exclude_patterns":
  [
    ".bundle",
    ".git",
    ".sass-cache"
  ],
  "font_face": "Inconsolata",
  "font_size": 16.0,
  "ignored_packages":
  [
    "Base16 Color Schemes",
    "Theme - Soda SolarizedDark",
    "Vintage"
  ],
  "index_files": true,
  "line_padding_bottom": 1,
  "line_padding_top": 1,
  "rulers":
  [
    80
  ],
  "save_on_focus_lost": true,
  "tab_size": 2,
  "theme": "Spacegray.sublime-theme",
  "translate_tabs_to_spaces": true,
  "trim_trailing_white_space_on_save": true,
  "word_wrap": false
}

Install Packages

  • Alignment: Easy alignment of multiple selections and multi-line selections
  • All Autocomplete: Extend Sublime Text 2 autocompletion to find matches in all open files of the current window
  • AutoFileName: Sublime Text plugin that autocompletes filenames
  • Better Coffee Script: Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.
  • Bootstrap 3 Snippets: Twitter Bootstrap 3 Snippets Plugin for Sublime Text 2/3
  • BracketHighlighter: Bracket and tag highlighter for Sublime Text
  • Click to Partial: Sublime Text 3 plugin for clicking a rails partial path and open the file.
  • Coffee Color Scheme: A minimalist theme and color scheme for Sublime Text.
  • CSS Extended Completions: CSS Completions, LESS Completions, SCSS Completions.
  • DashDoc: Dash integration for Sublime Text.
  • Dictionaries: Hunspell UTF8 dictionaries for Sublime Text.
  • DictionaryAutoComplete: This adds dictionary entries to the completions inside comments.
  • Emmet: Allows us to write HTML and CSS faster with abbreviations/shortcuts, then expand them in valid HTML tags
  • EncodingHelper: Guess encoding of files, show in status bar, convert to UTF-8 from a variety of encodings
  • FileDiffs: Shows diffs between the current file, or selection(s) in the current file, and clipboard, another file, or unsaved changes.
  • Git: Plugin for some git integration into sublime text
  • GitGutter: A Sublime Text 2/3 plugin to see git diff in gutter
  • Hover Preview: Sublime Text 3 Plugin for previewing images.
  • IndentXML: Plugin for Sublime Text editor for reindenting XML and JSON files
  • MarkDown Preview: Markdown preview and build plugin for Sublime Text 2/3.
  • MarkDown Editing: Even though SublimeText is capable of viewing and editing Markdown files, it treats it as plain text with very poor formatting. This plugin is useful for giving better support with proper color highlighting for Markdown in SublimeText.
  • Ruby Slim: A Textmate / Sublime Text bundle for Slim.
  • Sass: Sass support for TextMate & Sublime Text (2 & 3).
  • SideBarEnhancements: Enhancements to Sublime Text sidebar. Files and folders.
  • Slim Bundle: A Textmate / Sublime Text bundle for Slim.
  • SublimeCodeIntel: Full-featured code intelligence and smart autocomplete engine
  • SublimeLinter: Interactive code linting framework for Sublime Text 3
  • Swift for F*ing Sublime: Swift language grammar that doesn't suck.
  • Theme - Spacegray: A Hyperminimal UI Theme for Sublime Text.
  • TrailingSpaces: Highlight trailing spaces and delete them in a flash.

Setup Dropbox

Hide Personal Dropbox folder

chflags hidden "Dropbox (Personal)"

Hide Backup folder

chflags hidden "~/Dropbox (Iterar)/◆ Backup"

Sync Squarespace Notes

mv ~/Dropbox\ \(Personal\)/Apps/Squarespace\ Note ~/Notes

ln -s ~/Notes ~/Dropbox\ \(Personal\)/Apps/Squarespace\ Note

Sync Inspiration Folder

mv ~/Dropbox\ \(Personal\)/Public/Inspiration ~/Inspiration

ln -s ~/Inspiration ~/Dropbox\ \(Personal\)/Public/Inspiration

Sync Books

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Books ~/Books

ln -s ~/Books ~/Dropbox\ \(Iterar\)/◆\ Backup/Books

Sync Desktop

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Desktop/* ~/Desktop/

rm -r ~/Dropbox\ \(Iterar\)/◆\ Backup/Desktop

ln -s ~/Desktop ~/Dropbox\ \(Iterar\)/◆\ Backup/Desktop

Sync Documents

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Documents/* ~/Documents/

rm -r ~/Dropbox\ \(Iterar\)/◆\ Backup/Documents

ln -s ~/Documents ~/Dropbox\ \(Iterar\)/◆\ Backup/Documents

Sync Fonts

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Books ~/Books

ln -s ~/Books ~/Dropbox\ \(Iterar\)/◆\ Backup/Books

Sync Games

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Books ~/Books

ln -s ~/Books ~/Dropbox\ \(Iterar\)/◆\ Backup/Books

Sync Pictures

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Pictures/* ~/Pictures/

rm -r ~/Dropbox\ \(Iterar\)/◆\ Backup/Pictures

ln -s ~/Pictures ~/Dropbox\ \(Iterar\)/◆\ Backup/Pictures

Sync Presentations

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Books ~/Books

ln -s ~/Books ~/Dropbox\ \(Iterar\)/◆\ Backup/Books

Sync Resources

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Books ~/Books

ln -s ~/Books ~/Dropbox\ \(Iterar\)/◆\ Backup/Books

Sync Tutorials

mv ~/Dropbox\ \(Iterar\)/◆\ Backup/Books ~/Books

ln -s ~/Books ~/Dropbox\ \(Iterar\)/◆\ Backup/Books

Missing setup instructions

  • Setup Autoimporter to automatically import iPhone pictures into Pictures folder.
  • Install Inconsolata.
  • Setup Sublime Text typeface, theme and color theme.
  • Setup Xcode typeface and color theme.
  • Setup iTerm 2 typeface and theme.
  • Setup email signatures.
  • Install Safari plugins.
  • Install Sketch plugins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment