Skip to content

Instantly share code, notes, and snippets.

@theclue
Last active December 26, 2023 19:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theclue/c5c9a479e239058321973d9ec2fe7787 to your computer and use it in GitHub Desktop.
Save theclue/c5c9a479e239058321973d9ec2fe7787 to your computer and use it in GitHub Desktop.
My Ventura Macintosh DevBox
###
# XCODE
#
sudo xcode-select --install
###
# HOMEBREW
#
if test ! $(which brew); then
echo "Installing homebrew..."
yes '' | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> $HOME/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $HOME/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
brew tap homebrew/cask-versions
# Make sure we’re using the latest Homebrew and do some preliminary tasks
brew update
brew doctor
# Upgrade any already-installed formulae.
brew upgrade
###
# ESSENTIALS
#
brew install coreutils gnutls moreutils gnu-tar
sudo ln -s /usr/local/bin/gsha256sum /usr/local/bin/sha256sum
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
# Essential libraries
brew install gmp jpeg libsvg mpfr readline icu4c libxslt
brew install fontconfig libmpc libtiff webp libyaml pcre pcre2 freetype glib isl libtool little-cms2
brew install pixman arpack openblas gd gdk-pixbuf libcroco libwmf librsvg xz libmetalink gsl
# PKG & Dev essentials
brew install maven emacs node tcl-tk perl pkg-config cmake cmake-docs
# Use Perl Regular Expressions 2 by default
# (only for those built from source formulas)
export USE_LIBPCRE2=yes
####
# GIT
#
brew install --build-from-source git
brew install git-lfs git-flow git-extras git-gui hub diff-so-fancy git2 libgit2
# Set default git editor to be Sublime Text
git config --global core.editor "subl -n -w"
# Set default upstream branch to avoid --set-upstream message on first push
git config --global push.default current
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
git lfs install
sudo -u root git lfs install --system
###
# VISUAL STUDIO CODE
#
brew install --cask visual-studio-code
# install extensions
code --install-extension bierner.markdown-preview-github-styles
code --install-extension eamodio.gitlens
code --install-extension esbenp.prettier-vscode
code --install-extension GitHub.vscode-pull-request-github
code --install-extension ngryman.codesandbox-theme
##
# YARN
#
brew install yarn
##
# X
#
brew install --cask xquartz
##
# Compression utilities
#
brew install p7zip betterzip
##
# Network Related
#
brew install adns
brew install --build-from-source wget
brew install --build-from-source curl
brew install --build-from-source lynx
# Getting Data from various sources
brew install freexl e2fsprogs
##
# RUBY AND CRYSTAL
#
brew install ruby ruby-build rbenv crystal
LINE='eval "$(rbenv init -)"'
grep -q "$LINE" ~/.extra || echo "$LINE" >> ~/.extra
gem install bundler
gem install nokogiri -- --with-xslt-dir=$(brew --prefix libxslt)
##
# PYTHON
#
brew install python3
sudo -H pip3 install --upgrade pip setuptools
sudo -H pip3 install virtualenvwrapper --ignore-installed six
sudo -H pip3 install lxml
sudo -H pip3 install pelican
sudo -H pip3 install markdown
##
# TMUX
#
brew install tmux reattach-to-user-namespace
curl -o ~/.tmux.conf https://gist.githubusercontent.com/geeknam/d5c409b4ae5127a464c3/raw/541c3eb1bdbd6f3e38295c459dbc608153a4e417/.tmux.conf
##
# R with must-have packages
#
brew install --build-from-source r
sudo R CMD javareconf
Rscript -e 'install.packages("devtools", "rprojroot" repos = "http://cran.us.r-project.org")';
Rscript -e 'install.packages("tidyverse", "ggthemes", "futile.logger" repos = "http://cran.us.r-project.org")';
Rscript -e 'install.packages("rJava", repos = "http://cran.us.r-project.org")';
##
# Go with some caveats
#
brew install go
##
# DOCKER
#
brew install --cask docker
brew link docker
brew install docker docker-compose docker-machine
mkdir -p ~/.docker/cli-plugins
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
brew services start docker-machine
##
# FONTS UTILITIES
#
brew tap bramstein/webfonttools
brew install sfnt2woff sfnt2woff-zopfli woff2
##
# PUBLISHING AND GRAPHICS
#
brew install libsvg-cairo
brew install svg2pdf ghostscript
brew install imagemagick
brew install pandoc pandoc-citeproc pandoc-crossref
##
# OTHER MEDIA
#
brew install youtube-dl lame ffmpeg x264 xvid
##
# CORE SOFTWARE
#
brew install --cask macdown
brew install --cask sublime-text
brew install --cask mactex
brew install --cask safeincloud-password-manager
brew install --cask rstudio gephi
brew install --cask opera
brew install --cask firefox
brew install --cask calibre
brew install --cask textual
brew install --cask slack
brew install --cask discord
brew install --cask sublime-merge
brew install --cask iterm2
brew install --cask copyq
brew install --cask vlc
brew install --cask zoom
brew install --cask autodesk-fusion360
brew install --cask tableau
##
# Sublime Text - experimental
#
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" $(brew --prefix)/bin/sublime
subl --command "install_package_control"
subl --command "advanced_install_package {\"packages\": \"Dockerfile Syntax Highlighting,Terraform,LSP-terraform,Crystal\"}"
##
# GCP
#
brew install --cask google-cloud-sdk
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
# Google Cloud additional components
gcloud components install kubectl
brew install kubernetes-helm kubespy
brew install --cask lens
##
# TERRAFORM
#
brew install terraform
##
# Geo/GIS Analysis
#
brew install udunits gdal
brew install --cask qgis
Rscript -e 'install.packages("sf", "ggmap", "tidygeocoder", "RgoogleMaps" repos = "http://cran.us.r-project.org")';
##
# Harvesting/Crawling
#
brew install selenium-server
Rscript -e 'install.packages("rvest", "RSelenium", "RCurl", "httr", "urltools" repos = "http://cran.us.r-project.org")';
##
# QUICK-LOOK
#
brew install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize suspicious-package apparency quicklookase qlvideo
xattr -d -r com.apple.quarantine ~/Library/QuickLook
##########
# VARIOUS BREW POSTINSTALL CAVEATS and Z-Shell caveats
#
compaudit | xargs chmod g-w
sudo ln -sfn $(brew --prefix openjdk)/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
echo "export XML_CATALOG_FILES=\"$(brew --prefix)/etc/xml/catalog\"" >> ~/.zshrc
source $(brew --prefix git-extras)/share/git-extras/git-extras-completion.zsh
echo "export GUILE_TLS_CERTIFICATE_DIRECTORY=\"$(brew --prefix)/etc/gnutls\"" >> ~/.zshrc
echo "export GUILE_LOAD_PATH=\"$(brew --prefix guile)/share/guile/site/3.0\"" >> ~/.zshrc
echo "export GUILE_LOAD_COMPILED_PATH=\"$(brew --prefix guile)/lib/guile/3.0/site-ccache\"" >> ~/.zshrc
echo "export GUILE_SYSTEM_EXTENSIONS_PATH=\"$(brew --prefix guile)/lib/guile/3.0/extensions\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix coreutils)/libexec/gnubin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix tcl-tk)/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix libxslt)/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix libxml2)/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix flex)/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix gnu-getopt)/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix icu4c)/bin:$(brew --prefix sqlite)/bin:$(brew --prefix go)/libexec/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"$(brew --prefix icu4c)/sbin:\$PATH\"" >> ~/.zshrc
echo "export PERL5LIB=\"$(brew --prefix perl)/lib/perl5/site_perl\"" >> ~/.zshrc
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.zshrc
echo 'export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"' >> ~/.zshrc
echo "export USE_LIBPCRE2=yes" >> ~/.zshrc
echo "export GOROOT=`go env GOROOT`" >> ~/.zshrc
echo "export GOPATH=$HOME/src/go" >> ~/.zshrc
echo "export PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> ~/.zshrc
### Z-Shell auto completition
echo 'if type brew &>/dev/null; then' >> ~/.zshrc
echo ' FPATH=$(brew --prefix)/share/zsh-completions:$FPATH' >> ~/.zshrc
echo ' autoload -Uz compinit' >> ~/.zshrc
echo ' compinit' >> ~/.zshrc
echo 'fi' >> ~/.zshrc
rm -f ~/.zcompdump; compinit
chmod -R go-w $(brew --prefix)/share/zsh
# /CAVEATS
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# Showing percentage of battery in status
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
# Disable quarantine
defaults write com.apple.LaunchServices LSQuarantine -bool false
###############################################################################
# General UI/UX Settings #
###############################################################################
# Restart automatically if the computer freezes
sudo systemsetup -setrestartfreeze on
# Show the ~/Library folder
chflags nohidden ~/Library
###############################################################################
# Finder #
###############################################################################
# Showing all file extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Showing status bar by default
defaults write com.apple.finder ShowStatusBar -bool true
# Shows Tab View
defaults write com.apple.finder ShowTabView -bool true;
# Hide Path Bar
defaults write com.apple.finder ShowPathbar -bool false;
# Changes Finder to List View
# Four-letter codes for the other view modes: 'icnv', 'clmv', 'Flwv'
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# New Finder windows now opens in /Users/<username>
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# Turns on show Hard Disks, External disks, CDs, DVDs, and iPads, and Connected Servers
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true;
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true;
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true;
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true;
# Allowing text selection in Quick Look/Preview in Finder by default
defaults write com.apple.finder QLEnableTextSelection -bool true
# Disabling the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Expand the following File Info panes:
# “General”, “Open with”, and “Sharing & Permissions”
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# Sort folders first on Finder
defaults write com.apple.finder _FXSortFoldersFirst -bool YES
###############################################################################
# Screen #
###############################################################################
# Set default folder for screenshots
defaults write com.apple.screencapture location -string "${HOME}/Desktop/Screenshots"
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# Disable shadows around windows in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Disabling OS X Gate Keeper
sudo spctl --master-disable
sudo defaults write /var/db/SystemPolicy-prefs.plist enabled -string no
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable smart quotes and smart dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Enabling full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Turn off keyboard illumination when computer is not used for 5 minutes
defaults write com.apple.BezelServices kDimTime -int 300
# Avoiding the creation of .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Enabling snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# Enabling UTF-8 ONLY in Terminal.app and setting the Pro theme by default
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.Terminal "Default Window Settings" -string "Pro"
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro"
# Preventing Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Expand save panels by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
# Use plain text as default format in TextEdit and disable the rules
defaults write com.apple.TextEdit RichText -int 0
defaults write com.apple.TextEdit ShowRuler 0
# Disable the crash report dialog window
defaults write com.apple.CrashReporter DialogType none
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool true
# Menu bar: disable transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable the sudden motion sensor as it's not useful for SSDs
sudo pmset -a sms 0
# Disable automatic capitalization
defaults write -g NSAutomaticCapitalizationEnabled -bool false
# UTF-8 in Textedit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# Enable full keyboard access for all controls
# (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Set a fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
killall SystemUIServer
# Remove outdated versions from the cellar.
brew cleanup
rm -f -r /Library/Caches/Homebrew/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment