Skip to content

Instantly share code, notes, and snippets.

@germanny
Forked from jimmynotjim/_instructions.md
Last active February 16, 2024 16:25
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save germanny/7642823 to your computer and use it in GitHub Desktop.
Save germanny/7642823 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 and casks: brew 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"
  • Install Command Line Tools:

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

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

5. 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 youremail@example.com
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

6. Install Dotfiles

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

7. If not already part of your dotfiles, create a Brewfile or brew.sh or clone/modify the one below.

cd ~/ && curl -O  https://gist.githubusercontent.com/germanny/7642823/raw/a500b112cd769835796e5531e2bb95f233ff5723/brew.sh
sh brew.sh

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

NOTE

Node versions older than 15 do not work on Apple silicon machines (ARM) because ARM architecture is not supported. To install versions of Node < v15, you will need to install Node using Rosetta 2:

  1. In Applications, right-click on Terminal.app
  2. Click Get Info.
  3. Check "Open using Rosetta".
  4. Restart Terminal.

Now you will able to install any version of node (even multiple versions).

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

10. Log into NPM registry

$ npm config set registry https://registry.npmjs.org/
$ npm login --registry=https://registry.npmjs.org/

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

#!/usr/bin/env bash
# Install command-line tools using Homebrew.
# Make sure we’re using the latest Homebrew.
brew update
# Upgrade any already-installed formulae.
brew upgrade
# Save Homebrew’s installed location.
BREW_PREFIX=$(brew --prefix)
# Install GNU core utilities (those that come with macOS are outdated).
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
brew install coreutils
ln -s "${BREW_PREFIX}/bin/gsha256sum" "${BREW_PREFIX}/bin/sha256sum"
# Install some other useful utilities like `sponge`.
brew install moreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed.
brew install findutils
# Install GNU `sed`, overwriting the built-in `sed`.
brew install gnu-sed --with-default-names
# Install a modern version of Bash.
#brew install bash
brew install bash-completion2
# Switch to using brew-installed bash as default shell
if ! fgrep -q "${BREW_PREFIX}/bin/bash" /etc/shells; then
echo "${BREW_PREFIX}/bin/bash" | sudo tee -a /etc/shells;
chsh -s "${BREW_PREFIX}/bin/bash";
fi;
# Install `wget` with IRI support.
brew install wget --with-iri
# Install GnuPG to enable PGP-signing commits.
brew install gnupg
# Install more recent versions of some macOS tools.
brew install gmp
brew install grep
brew install openssh
# brew install php
brew install screen
brew install vim --with-override-system-vi
# brew install git
brew install git-lfs
brew install gs
brew install imagemagick --with-webp
brew install ssh-copy-id
brew install tree
# Install databases
brew install sqlite3
# Install utilities
brew install ansible
#brew install ag
brew install cdrtools
#brew install ctags
brew install gpg
brew install gpg2
brew install imagemagick
brew install jpeg
#brew install lnav
# brew install php-cs-fixer
brew install perl
brew install pyenv
#brew install pcre
#brew install reattach-to-user-namespace
brew install terminal-notifier
#brew install tmux
brew install tree
#brew install watch
brew install wget
# https://yarnpkg.com/en/docs/install#mac-tab
# brew install yarn --ignore-dependencies
# brew 'yarn', args: ["ignore-dependencies"]
# irc / instant message
#brew install 'bitlbee'
#brew install 'znc'
# Install GUI Mac applications (free/trials)
#https://agilebits.com/onepassword
brew install 1password
#http://www.alfredapp.com/
brew install alfred
#http://www.macbartender.com/
#brew install 'bartender'
#https://brave.com/
brew install brave-browser
#http://lightheadsw.com/caffeine/
#brew install 'caffeine'
#http://macpaw.com/cleanmymac
#brew install 'cleanmymac3'
#http://sourcegear.com/diffmerge/
#brew install 'diffmerge'
#https://www.dropbox.com/
#brew install 'dropbox'
#https://evernote.com/
#brew install 'evernote'
#https://flexibits.com/fantastical
#brew install 'fantastical'
#http://www.mozilla.org/en-US/firefox/new/
brew install firefox
#http://justgetflux.com/
#brew install 'flux'
#https://www.gimp.org/
#brew install 'gimp'
#https://www.google.com/intl/en/chrome/browser/
#brew install 'google-chrome'
#https://tools.google.com/dlpage/drive
#brew install 'google-drive'
#http://handbrake.fr/
#brew install 'handbrake'
#http://imageoptim.com/
#brew install 'imageoptim'
#http://iterm.sourceforge.net/
brew install iterm2
#http://www.sticksoftware.com/software/Jiggler.html
brew install jiggler
#https://snark.github.io/jumpcut/
brew install jumpcut
#https://orbstack.dev/
brew install orbstack
#https://www.postman.com/
brew install postman
#https://rectangleapp.com/
brew install rectangle
#http://www.sequelpro.com/
#brew install 'sequel-pro'
#http://www.bohemiancoding.com/sketch/
#brew install 'sketch'
#https://evernote.com/skitch/
#brew install 'skitch'
#https://slack.com/downloads/osx
#brew install 'slack'
#http://spectacleapp.com/
#brew install 'spectacle'
#https://www.sublimetext.com/
#brew install 'sublime-text'
#http://smilesoftware.com/TextExpander/index.html
#brew install 'textexpander'
#http://www.git-tower.com/
#brew install 'tower'
#http://panic.com/transmit/
#brew install 'transmit'
#http://www.vagrantup.com/
#brew install 'vagrant'
#http://vagrantmanager.com/
#brew install 'vagrant-manager'
#https://www.virtualbox.org/
#brew install 'virtualbox'
#https://code.visualstudio.com/
brew install visual-studio-code
#http://www.videolan.org/vlc/index.html
#brew install 'vlc'
#http://iconfactory.com/software/xscope
brew install xscope
# Install Mac App Store apps
brew install mas
#mas "Spark", id: 1176895641
#mas "Patterns", id: 429449079
#mas "Bear", id: 1091189122
#mas "Numbers", id: 409203825
[
  // 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" }
]
~
$ npm list -g --depth=0
/Users/jgermann/.nvm/versions/node/v20.10.0/lib
├── corepack@0.22.0
└── npm@10.2.3
brew install 1password alfred beekeeper-studio brave-browser datagrip firefox iterm2 jiggler jumpcut orbstack postman rectangle visual-studio-code
~
$ brew list
==> Formulae
act			icu4c			m4
ansible			imagemagick		moreutils
aom			imath			mpdecimal
apr			jasper			mysql
apr-util		jbig2dec		ncurses
argon2			jpeg			netpbm
aspell			jpeg-turbo		nettle
autoconf		jpeg-xl			npth
awscli			jq			oniguruma
bash			krb5			openexr
bash-completion@2	ldns			openjpeg
bdw-gc			libassuan		openldap
berkeley-db		libavif			openssl@1.1
brotli			libcbor			openssl@3
ca-certificates		libde265		p11-kit
cairo			libevent		pango
capstone		libfido2		pcre2
cdrtools		libgcrypt		perl
cffi			libgpg-error		php
colima			libheif			php-cs-fixer
coreutils		libidn			php@8.1
curl			libidn2			pinentry
docker			libksba			pixman
docker-compose		liblqr			pkg-config
docutils		libmd			protobuf@21
dpkg			libnghttp2		pycparser
findutils		libomp			pyenv
fontconfig		libpng			python@3.11
freetds			libpq			pyyaml
freetype		libraw			qemu
fribidi			librsvg			readline
gd			libslirp		rtmpdump
gdbm			libsodium		screen
gdk-pixbuf		libssh			shared-mime-info
gettext			libssh2			six
ghostscript		libtasn1		snappy
giflib			libtiff			sqlite
git			libtool			ssh-copy-id
git-lfs			libunistring		terminal-notifier
glib			libusb			tfenv
gmp			libvmaf			tidy-html5
gnu-tar			libx11			tree
gnupg			libxau			unbound
gnutls			libxcb			unixodbc
go			libxdmcp		vde
go-md2man		libxext			webp
gpatch			libxrender		wget
graphite2		libyaml			x265
grep			libzip			xorgproto
gts			lima			xz
guile			little-cms2		zlib
harfbuzz		lz4			zstd
highway			lzo			mas

==> Casks
beekeeper-studio	dropbox			postman
brave-browser		firefox			rectangle
chromium		inkdrop			skitch
cleanmymac		iterm2			visual-studio-code
datagrip		jumpcut

{ "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