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 currently install brew packages:
- 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
# 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.
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 [email protected]
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
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 [email protected]: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
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 [email protected]: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
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:
- https://github.com/rbenv/rbenv#homebrew-on-mac-os-x
- https://cbednarski.com/articles/installing-ruby/
- http://blog.zerosharp.com/installing-ruby-with-homebrew-and-rbenv-on-mac-os-x-mountain-lion/.
Open .bash_profile
and make the following edits
- Add local bin and local sbin ahead of $PATH
/usr/local/bin:/usr/local/sbin:
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.
https://getcomposer.org/doc/00-intro.md#globally
PATH update below.
https://github.com/riobard/bash-powerline
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"
My current preferred color scheme: https://draculatheme.com/
My previous color scheme:
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
My preferred version of Monokai Extended Bright
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
Install Package Manager
https://github.com/FriendsOfPHP/PHP-CS-Fixer#globally-homebrew http://benmatselby.github.io/sublime-phpcs/
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
See my Package Control User Settings. See my ST User Preferences.
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
Caffeine toggle- Caffeinate
- CanIUse
- Colors
- Dash
- Domainr
- Eject Disks.
- Emoji
- Encode/Decode
- Faker
- Font Awesome
- GitHub
- iOS Simulator
- IP Address
- Kill Process
- Open with Sublime Text
- Package Managers
- Shorten URL
- Transmit Favorites
- Unicode Symbols Search
Can use Alfred Workflow Searcher to get many of these.
17. Set NPM user
npm adduser username
Ubuntu 12.04 LTS 64-bits
vagrant box add precise64 http://files.vagrantup.com/precise64.box
You need all these:
These should have been installed above:
- NodeJS v0.10
- Yeoman v1
- Bower v1.3.3+
- Genesis WordPress Generator
- git-open- Type git open to open the repo website (GitHub, GitLab, Bitbucket) in your browser.
These were installed in your Brewfile:
- Vagrant
- VirtualBox
- Vagrant-Manager - helps you manage all your virtual machines in one place directly from the menubar
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.
This process has been borrowed from here, here, here, here, here, here, and of course, here.