Skip to content

Instantly share code, notes, and snippets.

@morristech
Forked from germanny/_instructions.md
Created April 24, 2022 11:56
Show Gist options
  • Select an option

  • Save morristech/8f21c910099cde937c7a9ad0acada57e to your computer and use it in GitHub Desktop.

Select an option

Save morristech/8f21c910099cde937c7a9ad0acada57e to your computer and use it in GitHub Desktop.
Instructions for setting up OSX

Setup OSX 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.

TODO: Add info about dotfiles set up and zsh (possible settings file?)

  • Save all dotfiles to a repo for easy transfer
  • Back up all photos, music, apps, iTunes library, keychains, etc.
  • Deauthorize iTunes and Photoshop.
  • Deactivate CleanMyMac 3 license.
  • 1Password, Dropbox, Evenote sync
  • 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 (IDE, Adobe apps, key bindings, 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

  • 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

Other commands for preferences here.

4. Configure Git and Generate SSH keys for GitHub

After installing git, set your user info. Then, enable Git password caching

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. Visit git-scm.com for more info on first time git setup. Visit pksunkara/config for a good sample config.

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 Homebrew

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

This will clone and install Homebrew. This includes Homebrew-Cask now.

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

Create your own Brewfile or clone this one and update with your own apps.

cd ~/ && curl -O  https://gist.githubusercontent.com/germanny/7642823/raw/73b407034bea20d08d287bda46ecdef5f165c556/Brewfile
brew update
brew upgrade
brew install mas
brew bundle

6. Install NVM and Global Packages with NPM

Install NVM

To install or update nvm, you can use the install script using cURL:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Open a new terminal window to start using NVM.

To download, compile, and install the latest release of node, do this:

nvm install node

And then in any new shell just use the installed version:

nvm use node

Or you can just run it:

nvm run node --version

Install global packages

When you install node.js, npm is automatically installed. However, npm gets updated more frequently than Node.js, so be sure you have the latest version.

To test, run npm -v and compare to latest release.

To update, run:

npm install npm@latest -g

Then install global packages:

npm install -g live-server npm npm-check-updates npx prettier

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/

7. Install Dotfiles

If you saved your dotfiles, now is the time to install them on your clean machine.

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

9. Set NPM user

npm adduser username

10. Install Alfred Workflows

Many of these no longer work on Macs with the silicon chip, but here's the list anyway.

Can use Alfred Workflow Searcher to get many of these.

All done, have fun!

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

[
  // Show all errors
    { "keys": ["ctrl+super+shift+a"], "command": "sublime_linter_panel_toggle" },
    { "keys": ["super+ctrl+a"], "command": "alignment" },
    { "keys": ["super+v"], "command": "paste_and_indent" },
    { "keys": ["super+shift+v"], "command": "paste" }
]
cask_args appdir: '/Applications'
#
# 1 taps
#
# caskroom versions
tap 'homebrew/cask-versions'
#
# 2 casks
# GUI Mac applications (free/trials)
#
#https://agilebits.com/onepassword
#cask '1password'
#http://www.alfredapp.com/
#cask 'alfred3'
#http://www.macbartender.com/
cask 'bartender'
#http://lightheadsw.com/caffeine/
cask 'caffeine'
#http://macpaw.com/cleanmymac
cask 'cleanmymac3'
#http://sourcegear.com/diffmerge/
cask 'diffmerge'
#https://www.dropbox.com/
cask 'dropbox'
#https://evernote.com/
#cask 'evernote'
#https://flexibits.com/fantastical
cask 'fantastical'
#http://www.mozilla.org/en-US/firefox/new/
#cask 'firefox'
#http://justgetflux.com/
#cask 'flux'
#https://www.gimp.org/
#cask 'gimp'
#https://www.google.com/intl/en/chrome/browser/
#cask 'google-chrome'
#https://tools.google.com/dlpage/drive
#cask 'google-drive'
#http://handbrake.fr/
#cask 'handbrake'
#http://imageoptim.com/
cask 'imageoptim'
#http://iterm.sourceforge.net/
cask 'iterm2'
#https://snark.github.io/jumpcut/
cask 'jumpcut'
#http://www.sequelpro.com/
cask 'sequel-pro'
#http://www.bohemiancoding.com/sketch/
cask 'sketch'
#https://evernote.com/skitch/
cask 'skitch'
#https://slack.com/downloads/osx
#cask 'slack'
#http://spectacleapp.com/
#cask 'spectacle'
#https://github.com/rxhanson/Rectangle
cash 'rectangle'
#https://www.sublimetext.com/
cask 'sublime-text'
#http://smilesoftware.com/TextExpander/index.html
cask 'textexpander'
#http://www.git-tower.com/
cask 'tower'
#http://panic.com/transmit/
cask 'transmit'
#http://www.vagrantup.com/
#cask 'vagrant'
#http://vagrantmanager.com/
#cask 'vagrant-manager'
#https://www.virtualbox.org/
#cask 'virtualbox'
#https://code.visualstudio.com/
cask 'visual-studio-code'
#http://www.videolan.org/vlc/index.html
#cask 'vlc'
#http://iconfactory.com/software/xscope
cask 'xscope'
#
# 3 editor / pager
#
brew 'vim'
#
# 4 programming environment
#
#brew 'apple-gcc42
#brew 'autoconf
#brew 'automake
#brew 'gettext
#brew 'intltool
#
# 5 programming languages
#
# clojure
#brew 'leiningen'
# erlang
#brew 'erlang'
#brew 'elixir'
#brew 'rebar'
# go
#brew 'go'
# groovy
#brew 'groovy'
# haskell
#brew 'haskell-platform'
# lua
#brew 'lua'
# mono (.net)
# https://gist.github.com/shtirlic/4696903
# node
#brew 'node'
# ocaml
#brew 'ocaml'
# python
#brew 'python'
# ruby
#brew 'chruby'
#brew 'ruby-install'
# rust
#brew 'rust'
# scala
#brew 'scala'
#
# 6 networking
#
#brew 'fping'
#brew 'netcat'
#brew 'ngrep'
#brew 'nmap'
#brew 'stunnel'
#brew 'tcpdump'
#
# 7 vcs
#
#brew 'git'
#brew 'mercurial'
#
# 8 web browsers
#
# finally this has been bottled
#brew 'phantomjs'
#
# 9 databases
#
#brew 'redis'
#brew 'riak'
brew 'sqlite3'
#
# 10 utilities
#
brew 'ansible'
#brew 'ag'
brew 'cdrtools'
#brew 'ctags'
brew 'gpg'
brew 'gpg2'
brew 'imagemagick'
brew 'jpeg'
#brew 'lnav'
brew 'php-cs-fixer'
#brew 'pcre'
#brew 'reattach-to-user-namespace'
brew 'terminal-notifier'
#brew 'tmux'
brew 'tree'
#brew 'watch'
brew 'wget'
# https://yarnpkg.com/en/docs/install#mac-tab
# brew install yarn --ignore-dependencies
# brew 'yarn', args: ["ignore-dependencies"]
# irc / instant message
#brew 'bitlbee'
#brew 'znc'
#
# 11 Mac App Store apps
#
#mas "Kindle", id: 405399194
#mas "Pages", id: 409201541
mas "Spark", id: 1176895641
mas "Patterns", id: 429449079
mas "Bear", id: 1091189122
#mas "Numbers", id: 409203825

{ "eslint.alwaysShowStatus": true, "editor.autoClosingQuotes": "always", "editor.autoIndent": "full", "editor.bracketPairColorization.enabled": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.detectIndentation": false, "editor.find.seedSearchStringFromSelection": "always", "editor.fontFamily": "OperatorMono-Book", "editor.fontSize": 18, "editor.formatOnPaste": true, "editor.formatOnSave": true, "editor.formatOnSaveMode": "modifications", "editor.formatOnType": false, "editor.guides.bracketPairs": "active", "editor.insertSpaces": true, "editor.largeFileOptimizations": false, "editor.matchBrackets": "always", "editor.minimap.enabled": false, "editor.multiCursorModifier": "ctrlCmd", "editor.quickSuggestions": { "strings": true }, "editor.renderWhitespace": "all", "editor.scrollBeyondLastLine": true, "editor.showFoldingControls": "always", "editor.snippetSuggestions": "top", "editor.suggestSelection": "first", "editor.tabSize": 2, "editor.trimAutoWhitespace": true, "editor.useTabStops": true, "editor.wordWrap": "on", "eslint.codeAction.showDocumentation": { "enable": true }, "eslint.options": { "configFile": "/Users/jgermann" }, "files.insertFinalNewline": true, "files.saveConflictResolution": "askUser", "files.trimTrailingWhitespace": true, "formatFiles.extensionsToInclude": "["html"]", "git.autofetch": true, "githubPullRequests.fileListLayout": "tree", "liveServer.settings.donotShowInfoMsg": true, "material-icon-theme.showWelcomeMessage": false, "terminal.external.osxExec": "iTerm.app", "terminal.integrated.fontSize": 16, "terminal.integrated.fontWeight": "500", "terminal.integrated.fontWeightBold": "700", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "window.closeWhenEmpty": true, "window.title": "${activeEditorFull}${separator}${rootName}", "workbench.colorTheme": "Dracula", "workbench.preferredDarkColorTheme": "Dracula", "workbench.preferredHighContrastColorTheme": "Dracula", "[elm]": { "editor.defaultFormatter": "elmTooling.elm-ls-vscode", "editor.formatOnSave": true, "editor.formatOnSaveMode": "file", "editor.tabSize": 4 }, "[javascript][json][typescript]": { "editor.formatOnSave": true, "editor.formatOnSaveMode": "file", "editor.tabSize": 2 }, "javascript.updateImportsOnFileMove.enabled": "always", "typescript.updateImportsOnFileMove.enabled": "always", "files.associations": { ".tag": "liquid", ".block": "liquid", ".env": "editorconfig" }, "search.exclude": { "/node_modules": false }, "files.watcherExclude": { "/node_modules/**": false }, "tailwindCSS.colorDecorators": true, "tailwindCSS.emmetCompletions": true, "tailwindCSS.includeLanguages": { "javascript": "javascript", "plaintext": "html", "typescript": "javascript", "typescriptreact": "javascript" }, "tailwindCSS.experimental.classRegex": [ "tw([^])", // tw... "tw="([^\"])", //

"tw={"([^\"}])", // <div tw={"..."} /> "tw\.\w+([^])", // tw.xxx... "tw\(.?\)([^])", // tw(Component)... "css={([^}])", // <div css={...} /> ["classnames\(([^)])\)", "'([^'])'"] ], "css.validate": false, "scss.validate": false, "security.workspace.trust.untrustedFiles": "open", "terminal.integrated.scrollback": 10000, "terminal.integrated.profiles.osx": { "bash": { "path": "bash", "args": ["-l"], "icon": "terminal-bash" }, "zsh": { "path": "zsh", "args": ["-l"] }, "fish": { "path": "fish", "args": ["-l"] }, "tmux": { "path": "tmux", "icon": "terminal-tmux" }, "pwsh": { "path": "pwsh", "icon": "terminal-powershell" }, "bash (2)": { "path": "/usr/local/bin/bash" } }, "terminal.integrated.defaultProfile.osx": "bash (2)", "terraform.languageServer": { "external": true }, "workbench.colorCustomizations": { "editorBracketHighlight.foreground1": "#ffb86c", "editorBracketHighlight.foreground2": "#ff79c6", "editorBracketHighlight.foreground3": "#8be9fd", "editorBracketHighlight.foreground4": "#f1fa8c", "editorBracketHighlight.foreground5": "#bd93f9", "editorBracketHighlight.foreground6": "#50fa7b" }, "editor.accessibilitySupport": "off", "[prisma]": { "editor.defaultFormatter": "Prisma.prisma" }, "diffEditor.renderSideBySide": false, "codetour.showMarkers": true, "cSpell.enabled": true, "better-comments.tags": [ { "tag": "!", "color": "#191A21", "strikethrough": false, "underline": false, "backgroundColor": "#FF5555", "bold": false, "italic": false }, { "tag": "FIXME", "color": "#191A21", "strikethrough": false, "underline": false, "backgroundColor": "#FF5555", "bold": false, "italic": false }, { "tag": "?", "color": "#191A21", "strikethrough": false, "underline": false, "backgroundColor": "#ffb86c", "bold": false, "italic": false }, { "tag": "//", "color": "#6272a4", "strikethrough": true, "underline": false, "backgroundColor": "transparent", "bold": false, "italic": false }, { "tag": "TODO", "color": "#282a36", "strikethrough": false, "underline": false, "backgroundColor": "#f1fa8c", "bold": false, "italic": false }, { "tag": "", "color": "#98C379", "strikethrough": false, "underline": false, "backgroundColor": "transparent", "bold": false, "italic": false } ] }

{
"recommendations": [
"humao.rest-client",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"vsls-contrib.codetour"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment