Skip to content

Instantly share code, notes, and snippets.

@marcuslilja
Last active September 21, 2023 08:02
Show Gist options
  • Save marcuslilja/8100205 to your computer and use it in GitHub Desktop.
Save marcuslilja/8100205 to your computer and use it in GitHub Desktop.
Clean Install – macOS Mojave (10.14)

macOS Mojave (10.14)

To be able to install all applications. We need to unlock the "Anywhere" setting in Gatekeeper.

sudo spctl --master-disable

Applications

A simple list of regular applications and plugins.

Regular downloads

App Store downloads

Browser plugins

Terminal setup

Be sure to download and install iTerm2 before you continue.

Install Zsh (Oh My Zsh)

Start installation

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

The installation will promt for Xcode Command Line Utilities to be installed. If the installation fails, run the command above again when Xcode Command Line Utilities has finished installing.

Install Homebrew

Start installation

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

Opt out from analytics

brew analytics off

Install some needed packages

brew install git ack wget curl gdbm gcc

Create public key for Github

Create public key (use default storage)

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

Add private key

ssh-add -K ~/.ssh/id_rsa

Copy ssh key to Github

cat ~/.ssh/id_rsa.pub

Test connection to Github

ssh -T git@github.com

Install Pure theme

Clone repository to home directory

git clone git@github.com:sindresorhus/pure.git ~/.zsh-themes/pure

Create site-functions folder

sudo mkdir -p /usr/local/share/zsh/site-functions

Create symlinks for Pure

sudo ln -s ~/.zsh-themes/pure/pure.zsh /usr/local/share/zsh/site-functions/prompt_pure_setup
sudo ln -s ~/.zsh-themes/pure/async.zsh /usr/local/share/zsh/site-functions/async

Fix permissions for site-functions

sudo chown -R <username>:admin /usr/local/share

Create symlinks for Oh My Zsh

ln -s ~/.zsh-themes/pure/pure.zsh ~/.oh-my-zsh/custom/pure.zsh-theme
ln -s ~/.zsh-themes/pure/async.zsh ~/.oh-my-zsh/custom/async.zsh

Edit ~/.zshrc and set Pure as your theme

ZSH_THEME="pure"

Restart iTerm2.

Install zsh-syntax-highlighting

Clone repository to home directory

git clone git@github.com:zsh-users/zsh-syntax-highlighting.git ~/.zsh-plugins/zsh-syntax-highlighting

Install syntax highlighting

echo "source ${(q-)PWD}/.zsh-plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Restart iTerm2.

Install Snazzy theme

Right-click and install Snazzy.itermcolors.

Activate colors in iTerm2 from Settings -> Profiles -> Colors.

Activate ZSH auto-complete functions

For some autocomplete niceness update ~/.zshrc with:

plugins=(
  git
  github
  nvm
  npm
  node
)

Enable jump forwards/backwards with alt + arrow

Activate alt + arrow jumping in Settings -> Profiles -> Keys.

Add backwards jumping

Keyboard Shortcut: ⌥←
Action: Send Escape Sequence
Esc+: b

Add forwards jumping

Keyboard Shortcut: ⌥→
Action: Send Escape Sequence
Esc+: f

OS X Preferences

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

# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true

# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 15

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

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 path

mkdir -p ~/Library/KeyBindings

Create file

pico ~/Library/KeyBindings/DefaultKeyBinding.dict

Paste the following

{ "~ " = ("insertText:", " "); }

Save and exit.

GIT Settings

Basic GIT settings

git config --global user.name "<your-name>"
git config --global user.email "<your-email>"
git config --global github.user "<username>"

git config --global color.ui true
git config --global push.default simple
git config --global pager.branch false
git config --global credential.helper osxkeychain
git config --global pull.rebase true

git config --global commit.gpgsign true
git config --global user.signingkey "<sign-key>"

Install Node with NVM

Install NVM

brew install nvm

Create NVM folder

mkdir ~/.nvm

Add the following to your ~/.zshrc file

export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm

Install a node version

nvm install <version>

Set installed version to default

nvm alias default <version>

Install Yarn

Install Yarn with NPM to select specific version.

npm install -g yarn@<version>

Installing Heroku CLI

Start installation

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