Skip to content

Instantly share code, notes, and snippets.

@shreeve
Last active October 16, 2024 20:21
Show Gist options
  • Save shreeve/ebe427a1c6e3caccc4a491176cc5e8c6 to your computer and use it in GitHub Desktop.
Save shreeve/ebe427a1c6e3caccc4a491176cc5e8c6 to your computer and use it in GitHub Desktop.
Install macOS

Setup macOS (updated for Sequoia)

Initial setup

  • Add the Applications icon:
    • Click on the desktop and enter Command-Shift-A to open Applications
    • Drag the Applications folder just left of the Downloads icon on the dock
    • Right click on the new Applications icon and select to View Content as a List
    • Do the same for the Downloads icon
    • From Applications, choose Utilities and then Terminal to continue

Allow sudo without a password

touch ~/.viminfo && sudo vi /etc/sudoers

# insert 'NOPASSWD' in following line:

%admin  ALL = (ALL) NOPASSWD: ALL

Hostname

x=(HostName LocalHostName ComputerName); for y in $x; sudo scutil --set $y pop

Disable Spotlight

sudo mdutil -a -i off

Install homebrew

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

macOS settings

• Accessibility -> Zoom -> Use scroll gesture with modifier keys to zoom
• Accessibility -> Zoom -> Modifier key for scroll gesture -> Command
• Accessibility -> Display -> Reduce Motion
• Control Center -> Bluetooth -> Show in Menu Bar
• Control Center -> Sound -> Always Show in Menu Bar
• Control Center -> Battery -> Show Percentage
• Control Center -> Clock Options -> Show date -> Always
• Control Center -> Clock Options -> Flash the time separators -> Enabled
• Control Center -> Clock Options -> Display the time with seconds -> Enabled
• Desktop & Dock -> Mission Control -> When switching to an application... -> Disabled
• Displays -> More Space
• Wallpaper -> Update image
• Spotlight -> Uncheck everything
• Keyboard -> Keyboard navigation -> Enabled
• Keyboard -> Keyboard Shortcuts -> Function Keys -> Use as standard function keys -> Enabled
• Keyboard -> Input Sources -> Add period with double-space -> Disabled
• Keyboard -> Input Sources -> Use smart quotes and dashes -> Disabled
• Keyboard -> Input Sources -> For double quotes -> Normal / Straight
• Keyboard -> Input Sources -> For single quotes -> Normal / Straight
• Mouse -> Natural scrolling -> Disabled
• Printers & Scanners -> Add Printer, Scanner, or Fax...
• Printers & Scanners -> Remove Fax

Install tools

brew install coreutils openssl readline ssh-copy-id wget git mc pv rename rsync tree httpie htop-osx p7zip duti fd sd jq jless xq tmux watch

Finder settings

• Settings -> General -> New Finder windows show -> (select home directory)
• Settings -> Sidebar -> Favorites -> Enable home directory
• Settings -> Advanced -> Keep folders on top -> Enable both options
• Settings -> Advanced -> When performing a search -> Search the Current Folder

Command line method to set some of the above

defaults write -g AppleSpacesSwitchOnActivate -bool false # keeping new windows on the current desktop

Prevent macOS from writing .DS_Store files on attached drives

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

Install git-home

mkdir -p -m 755 ~/.ssh
cp /Volumes/Latest/Setup/.ssh/id_rsa ~/.ssh/
git clone [email protected]:shreeve/home.git
home/.git-home/hooks/bootstrap
exec zsh

Install applications

brew install iterm2
brew install google-chrome
brew install google-drive
brew install github
brew install imageoptim
brew install beyond-compare
brew install visual-studio-code
brew install --no-quarantine qlmarkdown
brew install --no-quarantine syntax-highlight

Configure iterm2

# apply settings that can use defaults
defaults write com.googlecode.iterm2 AllowClipboardAccess     -bool true
defaults write com.googlecode.iterm2 ClickToSelectCommand     -bool false
defaults write com.googlecode.iterm2 FocusFollowsMouse        -bool false
defaults write com.googlecode.iterm2 NoSyncTipsDisabled       -bool true
defaults write com.googlecode.iterm2 OpenArrangementAtStartup -bool false
defaults write com.googlecode.iterm2 OpenNoWindowsAtStartup   -bool false
defaults write com.googlecode.iterm2 PromptOnQuit             -bool false
defaults write com.googlecode.iterm2 QuitWhenAllWindowsClosed -bool true
defaults write com.googlecode.iterm2 SUAutomaticallyUpdate    -bool true
defaults write com.googlecode.iterm2 SUEnableAutomaticChecks  -bool true
defaults write com.googlecode.iterm2 UseBorder                -bool true

# apply settings that need PlistBuddy
plb -c "Set 'New Bookmarks':0:'Custom Directory'            'Recycle'"  ~/Library/Preferences/com.googlecode.iterm2.plist # open new windows same dir
plb -c "Set 'New Bookmarks':0:'Disable Window Resizing'     false"      ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Add 'New Bookmarks':0:'Draw Powerline Glyphs'       bool  true" ~/Library/Preferences/com.googlecode.iterm2.plist # add new (needs type)
plb -c "Set 'New Bookmarks':0:'Draw Powerline Glyphs'             true" ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Set 'New Bookmarks':0:'Scrollback Lines'            50000"      ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Add 'New Bookmarks':0:'Show Offscreen Command line' bool false" ~/Library/Preferences/com.googlecode.iterm2.plist # add new (needs type)
plb -c "Set 'New Bookmarks':0:'Show Offscreen Command line'      false" ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Set 'New Bookmarks':0:'Silence Bell'                true"       ~/Library/Preferences/com.googlecode.iterm2.plist

# set the color theme
iTerm2 -> Settings -> Profiles -> Colors -> Color Presets (bottom right) -> Dark Background

Force Chrome for .webloc URL shortcuts

duti -s com.google.Chrome com.apple.web-internet-location all

Force vscode for a variety of file types

list=(
  public.json public.plain-text public.python-script public.shell-script
  public.source-code public.text public.unix-executable
  c cfg conf cpp cs css go java js json jsx less log lua md
  php pl py rb sass scss toml ts tsx txt vue yaml yml
)
# Either .VSCode or .VSCodeInsiders
for x in $list; duti -s com.microsoft.VSCode $x all

Install asdf for versioning

brew install asdf
exec zsh

Install Node

asdf plugin add nodejs
asdf install nodejs latest
asdf global nodejs latest

Install Ruby

asdf plugin add ruby
asdf install ruby latest
asdf global ruby latest
exec zsh
ruby -v
gem update --system
gem update --default
gem cleanup

Install SQLite

brew install sqlite
ln -sf "${BREW}/opt/sqlite3/bin/sqlite3" "${BREW}/bin/"

Install TablePlus, DuckDB, and MySQL

brew install --cask tableplus
brew install duckdb
brew install mysql
mysql.server start # NOTE: `brew services start mysql` to start at boot
mysqldump -u root -t mysql user -w"user='root'" | grep '^INSERT ' | sed "s/root/`whoami`/" | mysql -u root mysql
mysqladmin -u root reload
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql
# might need this for Ruby
gem install mysql2 -- --with-opt-dir="$(brew --prefix zstd)"

Install nginx (TODO: easier to just compile it ourselves?)

brew install nginx
rm                             /opt/homebrew/etc/nginx/nginx.conf
ln -sf $t/www/nginx/nginx.conf /opt/homebrew/etc/nginx/
ln -sf $t/www/nginx/cors.conf  /opt/homebrew/etc/nginx/
ln -sf ~/ssl                   /opt/homebrew/etc/nginx/
openssl dhparam -out ~/ssl/dhparam.pem 2048 # if needed
ln -sf /opt/homebrew/var/log/nginx /opt/homebrew/Cellar/nginx/1.27.2/logs
ln -sf $t                          /opt/homebrew/Cellar/nginx/1.27.2/repo

Install mas (macOS App Store) for Xcode and others

brew install mas
mas install 540348655 # Monosnap (change filename template to "%Y-%m-%d %H-%M-%S - %W")
mas install 880001334 # Reeder
mas install 497799835 # Xcode - Make sure to launch and accept license, etc.

Other homebrew packages

awscli
forklift
graphicsmagick
ideviceinstaller
imagemagick
libimobiledevice
lazygit
nmap
tig
wemux
whatsapp
xsv

Install wasm support (OPTIONAL)

brew install llvm wabt # installs clang too
brew link --force llvm
exec zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment