Skip to content

Instantly share code, notes, and snippets.

@justsml
Last active January 7, 2024 14:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save justsml/6646bab85c9a516f3205d3f96953a380 to your computer and use it in GitHub Desktop.
Save justsml/6646bab85c9a516f3205d3f96953a380 to your computer and use it in GitHub Desktop.
MacOS setup

MacOS - Software Developer Environment Setup

Dan's collection of MacOS setup and configuration scripts, updated for 2022 🚀!

Table of Contents

Software & Apps

OS Configuration

Setup Brew

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

Browsers

brew install --cask firefox
brew install google-chrome

Shell Environment

Setup Oh My ZSH

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

Powerlevel 10k (ultimate ZSH theme)

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc
source ~/.zshrc # Activate environment, or restart terminal to begin automated setup.

Ultimate VIM

git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh

Shell Pro Tools

Rigrep

https://github.com/BurntSushi/ripgrep

brew install ripgrep

bat (improved cat)

brew install bat

fzf utility

brew install fzf
# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install

Frameworks / Languages

Node.js

CHOOSE either NVM or Volta.

NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.nvm/nvm.sh
nvm install 14

Volta

Use Volta for cross-platform Node.js version management.

curl https://get.volta.sh | bash
volta install node@14
volta setup
#> NOTE: Reload Terminal or run profile/*rc script.

(Optional) Per project Node version (requires package.json)

volta pin node@14

Java, Reduced Lawsuit Edition*

brew tap AdoptOpenJDK/openjdk
 # Install v11
brew install --cask adoptopenjdk11
 # Or v14
brew install --cask adoptopenjdk14

Common Brew Packages

#> My Core Tooling
brew install --cask iterm2
brew install --cask slack
brew install --cask visual-studio-code
brew install --cask notion

#> Multi-Database GUI
brew install --cask dbeaver-community

#> Window & Keyboard shortcut tools
brew install --cask rectangle # Recommended Window layout shortcut tool.
defaults write com.googlecode.iterm2 DisableWindowSizeSnap -integer 1 # Better iTerm + Rectangle behavior
# brew install --cask hammerspoon # A Lua scriptable MacOS automation.

#> CLI json parser
brew install jq 

#> Video Chat Apps
brew install --cask zoom
brew install microsoft-teams

#> Streaming & Video
brew install --cask kap
brew install --cask obs
brew install --cask screenflow  #> *License Required

#> Screenshot & Annotations
brew install --cask flameshot

#> GIF Editing, Resizing & Compression
brew install gifsicle

#> Office Tools
brew install microsoft-office

Development & DevOps Tooling

Docker

Download Docker for Mac.

Developer Fonts

Nerd Fonts are versions of popular fonts packed with added symbols/emoji for development & engineering.

Basically, they can make your terminal look awesome!

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
 # Optional Fonts - FOR REFERENCE ##
 # brew install --cask fira-code-nerd-font
 # brew install --cask hack-font-nerd-font
 # brew install --cask font-meslo-lg-nerd-font
 # brew install --cask font-roboto-mono-nerd-font
 # brew install --cask font-inconsolata-nerd-font
 # brew install --cask font-open-dyslexic-nerd-font

How To: Configure VS Code for Nerd Fonts

Configure VS Code's settings for editor.fontFamily and terminal.integrated.fontFamily.

Add the following options:

{
    "editor.fontFamily": "'MesloLGS NF', 'FiraCode Nerd Font Mono', 'Inconsolata Nerd Font Mono', 'Hack Nerd Font Mono', Menlo, Monaco, 'Courier New', monospace",
    "terminal.integrated.fontFamily": "'MesloLGS NF', 'FiraCode Nerd Font Mono', 'Inconsolata Nerd Font Mono', 'Hack Nerd Font Mono', Menlo, Monaco, 'Courier New', monospace"
}

Cloud Tooling

AWS CLI

brew install awscli
# EXIT & RE-OPEN TERMINAL
aws configure
curl https://sdk.cloud.google.com | bash
 # EXIT & RE-OPEN TERMINAL - or gcloud won't be found.
gcloud init

Mac OS Configuration

The sections below are organized by task or app.

Apply and adjust as needed for your use case.

Advanced/Note: If you would like to view any current option (if any) before making changes, change the defaults write [namespace] <Key/Path> command into its read equivalent. (defaults read [namespace] <Key/Path>)

Recommended for Pros

#> Expand save dialogs by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
#> Disable smart quotes & dashes - **annoying for development**
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
#> Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
#> Always show scroll bars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
#> Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
#> Dock: Automatically hide and show
defaults write com.apple.dock autohide -bool true

Finder

#> Show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
#> Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
#> Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
#> Show path bar
defaults write com.apple.finder ShowPathbar -bool true
#> Search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
#> Use "list view" in Finder by default
#>   codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"

Safari

#> Show status bar / url preview
defaults write com.apple.Safari ShowOverlayStatusBar -bool true
#> Dev mode & tooling
defaults write com.apple.Safari WebKitDeveloperExtras -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
#> Add URL tooltips on links
defaults write com.apple.Safari WebKitShowsURLsInToolTips -bool true
#> Show the full URL in address bar
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
#> 'find on page' to search all substrings
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false

Chrome

#> Disable the all-too-sensitive backswipe on trackpads
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
#> Disable the all-too-sensitive backswipe on Magic Mouse
defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false

Activity Monitor

#> Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
#> Visualize CPU usage in the Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
#> Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0

#> Print: Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
#> Print: Expand dialog by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

Increase Open File Limit

The OS default limits are problematic for modern software development. Modern front-end frameworks often run in a watch mode. Any process that watches the file system for changes can quickly hit these limits. This leads to errors like EFILE, silent failures and slowdowns.

Step 1 Create the necessary configuration file:

sudo cat << HEREDOC > /Library/LaunchDaemons/limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>65535</string>
      <string>524288</string>
    </array>
    <key>RunAtLoad</key>
    <true />
    <key>ServiceIPC</key>
    <false />
  </dict>
</plist>
HEREDOC

Step 2 Run the following commands to set needed permissions & load the configuration.

sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
launchctl limit maxfiles # Restart your computer, afterwards this should report the increased values.

Note: This only applies to people who use bluetooth audio devices with easy-to-press media buttons.

Tired of Apple Music opening every damn time you touch a connected speaker or headphones?!?

Me freakin' too!

Until Apple adds an option to turn off this madness, noTunes is a little app which will auto-kill it every time it tries to open.

To install, run this script, then double click the noTunes icon in your Applications folder.

curl -o ~/Downloads/noTunes.zip https://github.com/tombonez/noTunes/releases/download/v3.2/noTunes-3.2.zip
unzip ~/Downloads/noTunes.zip
cd ~/Downloads
mv noTunes.app ~/Applications/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment