diff --git a/.Brewfile b/.Brewfile index 4f3d016..3a056df 100644 --- a/.Brewfile +++ b/.Brewfile @@ -15,3 +15,4 @@ brew "fzf" brew "git" brew "zoxide" brew "stow" +brew "mosh" diff --git a/macutil.sh b/macutil.sh new file mode 100755 index 0000000..7636c29 --- /dev/null +++ b/macutil.sh @@ -0,0 +1,211 @@ +sudo -v +while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & +#/usr/bin/env bash +if ! command -v brew &> /dev/null; then + echo "Installing Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + # Add Homebrew to PATH for the rest of this session (Apple Silicon fix) + if [[ $(uname -m) == "arm64" ]]; then + eval "$(/opt/homebrew/bin/brew shellenv)" + else + eval "$(/usr/local/bin/brew shellenv)" + fi +fi + +DOTFILES_DIR="$HOME/dotfiles" +if [ ! -d "$DOTFILES_DIR" ]; then + echo "Cloning dotfiles..." +git clone https://git@moo:dmm/dotfiles.git +cd dotfiles +fi +cd "$DOTFILES_DIR" +brew bundle --file=.Brewfile + +stow . + +cd ~/ + +# Enable Touch ID for sudo +if ! grep -q "pam_tid.so" /etc/pam.d/sudo; then + echo "Enabling Touch ID for sudo..." + sudo sed -i '' '2i\ +auth sufficient pam_tid.so +' /etc/pam.d/sudo +fi + +# Enable Single App Mode +defaults write com.apple.dock single-app -bool true +defaults write com.apple.dock autohide-delay -float 0 +defaults write com.apple.dock autohide-time-modifier -float 0.2 +# Sets a blazingly fast repeat rate +defaults write NSGlobalDomain KeyRepeat -int 2 +# Sets how long you have to hold the key before it starts repeating +defaults write NSGlobalDomain InitialKeyRepeat -int 15 +defaults write com.apple.dock expose-animation-duration -float 0.1 +# Show all filename extensions +defaults write NSGlobalDomain AppleShowAllExtensions -bool true + +# Finder: show path bar (makes it easier to see exactly where you are) +defaults write com.apple.finder ShowPathbar -bool true + +# Keep folders on top when sorting by name (like Windows/Linux) +defaults write com.apple.finder _FXSortFoldersFirst -bool true + +# Enable the WebKit Developer Tools in the Mac App Store +defaults write com.apple.appstore WebKitDeveloperExtras -bool true + +# Enable Debug Menu in the Mac App Store +defaults write com.apple.appstore ShowDebugMenu -bool true + +# Enable the automatic update check +defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true + +# Check for software updates daily, not just once per week +defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 + +# Download newly available updates in background +defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 + +# Install System data files & security updates +defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 + +# Automatically download apps purchased on other Macs +defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 + +# Turn on app auto-update +defaults write com.apple.commerce AutoUpdate -bool true + +# Allow the App Store to reboot machine on macOS updates +defaults write com.apple.commerce AutoUpdateRestartRequired -bool true + +############################################################################### +# Safari & WebKit # +############################################################################### + +# Privacy: don’t send search queries to Apple +defaults write com.apple.Safari UniversalSearchEnabled -bool false +defaults write com.apple.Safari SuppressSearchSuggestions -bool true + +# Press Tab to highlight each item on a web page +defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true + +# Show the full URL in the address bar (note: this still hides the scheme) +defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true + +# Set Safari’s home page to `about:blank` for faster loading +defaults write com.apple.Safari HomePage -string "about:blank" + +# Prevent Safari from opening ‘safe’ files automatically after downloading +defaults write com.apple.Safari AutoOpenSafeDownloads -bool false + +# Allow hitting the Backspace key to go to the previous page in history +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true + +# Hide Safari’s bookmarks bar by default +defaults write com.apple.Safari ShowFavoritesBar -bool false + +# Hide Safari’s sidebar in Top Sites +defaults write com.apple.Safari ShowSidebarInTopSites -bool false + +# Disable Safari’s thumbnail cache for History and Top Sites +defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 + +# Enable Safari’s debug menu +defaults write com.apple.Safari IncludeInternalDebugMenu -bool true + +# Make Safari’s search banners default to Contains instead of Starts With +defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false + +# Remove useless icons from Safari’s bookmarks bar +defaults write com.apple.Safari ProxiesInBookmarksBar "()" + +# Enable the Develop menu and the Web Inspector in Safari +defaults write com.apple.Safari IncludeDevelopMenu -bool true +defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true + +# Add a context menu item for showing the Web Inspector in web views +defaults write NSGlobalDomain WebKitDeveloperExtras -bool true + +# Enable continuous spellchecking +defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true +# Disable auto-correct +defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false + +# Disable AutoFill +defaults write com.apple.Safari AutoFillFromAddressBook -bool false +defaults write com.apple.Safari AutoFillPasswords -bool false +defaults write com.apple.Safari AutoFillCreditCardData -bool false +defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false + +# Warn about fraudulent websites +defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true + +# Disable plug-ins +defaults write com.apple.Safari WebKitPluginsEnabled -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false + +# Disable Java +defaults write com.apple.Safari WebKitJavaEnabled -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false + +# Block pop-up windows +defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false + +# Disable auto-playing video +#defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false +#defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false +#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false +#defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false + +# Enable “Do Not Track” +defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true + +# Update extensions automatically +defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true + # Automatically hide and show the Dock + +defaults write com.apple.dock autohide -bool true + +# Don’t show recent applications in Dock +defaults write com.apple.dock show-recents -bool false + + +# Require password immediately after sleep or screen saver begins +defaults write com.apple.screensaver askForPassword -int 1 +defaults write com.apple.screensaver askForPasswordDelay -int 0 + +# Save screenshots to the desktop +defaults write com.apple.screencapture location -string "${HOME}/Desktop" + +# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) +defaults write com.apple.screencapture type -string "png" + +# Disable shadow in screenshots +defaults write com.apple.screencapture disable-shadow -bool true + +# Enable subpixel font rendering on non-Apple LCDs +# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 +defaults write NSGlobalDomain AppleFontSmoothing -int 1 + +# Enable HiDPI display modes (requires restart) +sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true + +# Disable “natural” (Lion-style) scrolling +defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false + +# Increase sound quality for Bluetooth headphones/headsets +defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 + +# Show language menu in the top right corner of the boot screen +sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true + +# Disable the sound effects on boot +sudo nvram SystemAudioVolume=" " + +# Disable the “Are you sure you want to open this application?” dialog +defaults write com.apple.LaunchServices LSQuarantine -bool false