Skip to content

Instantly share code, notes, and snippets.

@shreeve
Last active February 10, 2024 22:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 Sonoma 14.2)

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 visudo

# 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 -> Display -> Reduce Motion
• Accessibility -> Zoom -> Use scroll gesture with modifier keys to zoom
• Accessibility -> Zoom -> Modifier key for scroll gesture -> Command
• Control Center -> Bluetooth -> Show in Menu Bar
• Control Center -> Sound -> Always Show in Menu Bar
• 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
• Siri & Spotlight -> Ask Siri -> Disable
• Siri & Spotlight -> Spotlight -> Uncheck everything
• Displays -> More Space
• Wallpaper -> Update image
• 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 duti fd sd jq xq tmux watch

Install git-home

mkdir -p -m 755 ~/.ssh
cp /Volumes/Latest/Setup/.ssh/id_rsa ~/.ssh/
git clone git@github.com:shreeve/home.git
home/.git-home/hooks/bootstrap
exec zsh

Install applications

brew install iterm2
brew install google-chrome
brew install github
brew install imageoptim
brew install beyond-compare # requires "Rosetta Stone" be installed
brew install visual-studio-code # or, use: brew install homebrew/cask-versions/visual-studio-code-insiders
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 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
alias plb="/usr/libexec/PlistBuddy"
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:'Custom Directory'        'Recycle'" ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Set 'New Bookmarks':0:'Disable Window Resizing' false"     ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Set 'New Bookmarks':0:'Scrollback Lines'        50000"     ~/Library/Preferences/com.googlecode.iterm2.plist
plb -c "Set 'New Bookmarks':0:'Silence Bell'            true"      ~/Library/Preferences/com.googlecode.iterm2.plist

# note: this one sets the value but doesn't seem to have no impact?
plb -c "Set 'New Bookmarks':0:'Show Mark Indicators'    true"      ~/Library/Preferences/com.googlecode.iterm2.plist

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
)
for x in $list; duti -s com.microsoft.VSCodeInsiders $x all

Install wasm support (OPTIONAL)

brew install llvm wabt # installs clang too
brew link --force llvm
exec zsh

Install asdf for versioning

brew install asdf
exec zsh

Install Node

asdf plugin add nodejs
asdf install nodejs 18.18.2
asdf global nodejs 18.18.2

Install Ruby

asdf plugin add ruby
asdf install ruby 3.2.2
asdf global ruby 3.2.2
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 MySQL

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 -s ~/Data/Work/SSL /opt/homebrew/etc/nginx/ssl
openssl dhparam -out /opt/homebrew/etc/nginx/ssl/dhparam.pem 2048
ln -s /opt/homebrew/var/log/nginx /opt/homebrew/Cellar/nginx/1.23.3/logs
ln -s /Users/shreeve/Data/Code/trustlabs /opt/homebrew/Cellar/nginx/1.23.3/repo
ln -s $t/cors.conf /opt/homebrew/etc/nginx/
ln -s $t/nginx.conf /opt/homebrew/etc/nginx/

Install Xcode

# install Xcode via the App Store
sudo xcode-select -r # I had to do this to allow the `xed` command to run

Other homebrew packages

awscli
graphicsmagick
ideviceinstaller
imagemagick
libimobiledevice
lazygit
nmap
p7zip
tig
wemux
xsv

Install mas (macOS App Store)

brew install mas
mas install 412448059 # Forklift
mas install 540348655 # Monosnap (change filename template to "%Y-%m-%d %H-%M-%S - %W")
mas install 880001334 # Reeder
mas install 497799835 # Xcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment