Skip to content

Instantly share code, notes, and snippets.

@samhenrigold
Created July 2, 2021 14:58
Show Gist options
  • Save samhenrigold/7873048044abd755f97e7060a89c9b73 to your computer and use it in GitHub Desktop.
Save samhenrigold/7873048044abd755f97e7060a89c9b73 to your computer and use it in GitHub Desktop.
macOS Funky
#!/usr/bin/env bash
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.funky` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
sudo scutil --set ComputerName "shg"
sudo scutil --set HostName "shg"
sudo scutil --set LocalHostName "shg"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "shg"
# Show scrollbars only when scrolling
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling"
# Possible values: `WhenScrolling`, `Automatic` and `Always`
# Expand save panel 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
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable Resume system-wide
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
# Disable the crash reporter
defaults write com.apple.CrashReporter DialogType -string "none"
# Restart automatically if the computer freezes
systemsetup -setrestartfreeze off
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
# # Trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
# Enable “natural” (Lion-style) scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true
# Enable full keyboard access for all controls
# (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
###############################################################################
# Screen #
###############################################################################
# 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}/Pictures/Screenshots"
# # 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
defaults write NSGlobalDomain AppleFontSmoothing -int 2
###############################################################################
# Finder #
###############################################################################
# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Finder: allow text selection in Quick Look (unsure if this still works in 11.0)
defaults write com.apple.finder QLEnableTextSelection -bool true
# Remove delay to show proxy icons on hover
defaults write com.apple.Finder NSToolbarTitleViewRolloverDelay -float 0
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
# Remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0
# Avoid creating .DS_Store files on network shares
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
# Use column view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Show the ~/Library folder
chflags nohidden ~/Library
# 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
###############################################################################
# Dock, Dashboard, and hot corners #
###############################################################################
# Change minimize/maximize window effect
defaults write com.apple.dock mineffect -string "suck"
# Enable spring loading for all Dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
# Don’t animate opening applications from the Dock
defaults write com.apple.dock launchanim -bool false
# Don't bounce icons in the Dock
defaults write com.apple.dock no-bouncing -bool true
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -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
# Disable hitting the Backspace key to go to the previous page in history
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool false
# Show Safari’s bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool true
# # 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
###############################################################################
# Mail #
###############################################################################
# # Disable send and reply animations in Mail.app
# defaults write com.apple.mail DisableReplyAnimations -bool true
# defaults write com.apple.mail DisableSendAnimations -bool true
# Copy email addresses as `[email protected]` instead of `Foo Bar <[email protected]>` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"
# # Display emails in threaded mode, sorted by date (oldest at the top)
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"
# # Disable inline attachments (just show the icons)
# defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# # Disable automatic spell checking
# defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"
###############################################################################
# Activity Monitor #
###############################################################################
# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
# Sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
###############################################################################
# TextEdit #
###############################################################################
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
###############################################################################
# Mac App Store (unsure if these still work #
###############################################################################
# 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
###############################################################################
# Messages #
###############################################################################
# Disable automatic emoji substitution (i.e. use plain text smileys)
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
# Enable smart quotes
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool true
###############################################################################
# Archive utility #
###############################################################################
# Move archive files to trash after expansion
# Delete directly: "/dev/null"
# Leave alone (default) "."
defaults write com.apple.archiveutility dearchive-move-after -string "~/.Trash"
###############################################################################
# Everything else #
###############################################################################
# Figma - Default to sRGB
defaults write com.figma.Desktop ColorCorrectRendering -bool true
###############################################################################
# Get that funky stuff #
###############################################################################
# Get Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Brew packages
brew install ffmpeg
brew install wget
brew install youtube-dl
brew install webp
brew install node
# Apps via Brew
brew install --cask iina
brew install --cask github
brew install --cask spotify
brew install --cask discord
brew install --cask zeplin
brew install --cask figma
brew install --cask origami-studio
brew install --cask nova
brew install --cask sketch
brew install --cask omnigraffle
brew install --cask vmware-fusion
brew install --cask asset-catalog-tinkerer
brew install --cask audio-hijack
brew install --cask subler
brew install --cask fission
brew install --cask renamer
gem install wayback_machine_downloader
# Apps via wget
cd ~/Downloads
wget "https://installer.maxon.net/installer/24.111_CL348785/Cinema4D_S24_24.111_Mac.dmg"
echo "nice try" > vmwarekey.txt
wget "https://kiteapp.co/downloads/KiteCompositor.dmg"
hdiutil attach KiteCompositor.dmg
if cd /Volumes/Kite\ Compositor/; then
mv Kite.app /Applications
cd ~/Downloads
hditutil detach /Volumes/Kite\ Compositor/
rm KiteCompositor.dmg
fi
wget "https://devimages-cdn.apple.com/design/resources/download/SF-Symbols-3.dmg"
hdiutil attach "SF-Symbols-3.dmg"
if cd /Volumes/SFSymbols/; then
installer -pkg /Volumes/SFSymbols/SF\ Symbols.pkg -target /Applications
cd ~/Downloads
hditutil detach /Volumes/SFSymbols/
rm "SF-Symbols-3.dmg"
fi
wget "https://devimages-cdn.apple.com/design/resources/download/iOS-14-Sketch.dmg"
hdiutil attach "iOS-14-Sketch.dmg"
if cd /Volumes/iOS-14-Sketch/; then
cp -R "iOS 14 Sketch" ~/Downloads
cd ~/Downloads
hditutil detach /Volumes/iOS-14-Sketch/
rm "iOS-14-Sketch.dmg"
fi
wget "https://devimages-cdn.apple.com/design/resources/download/macOS-11-Sketch.dmg"
hdiutil attach "macOS-11-Sketch.dmg"
if cd /Volumes/macOS-11-Sketch/; then
cd ~/Downloads
mkdir "macOS 11 Sketch"
cd /Volumes/macOS-11-Sketch/
cp -R "Production Templates" ~/Downloads/macOS\ 11\ Sketch
cp -R "Design Templates + Components" ~/Downloads/macOS\ 11\ Sketch
hditutil detach /Volumes/macOS-11-Sketch/
rm "macOS-11-Sketch.dmg"
fi
wget "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg"
hdiutil attach "SF-Pro.dmg"
if cd /Volumes/SanFranciscoPro/; then
if installer -pkg /Volumes/SanFranciscoPro/San\ Francisco\ Pro.pkg; then
cd ~/Downloads
hditutil detach /Volumes/SanFranciscoPro/
rm "SF-Pro.dmg"
fi
fi
wget "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg"
hdiutil attach "SF-Compact.dmg"
if cd /Volumes/SanFranciscoCompact/; then
if installer -pkg /Volumes/SanFranciscoCompact/San\ Francisco\ Compact.pkg; then
cd ~/Downloads
hditutil detach /Volumes/SanFranciscoCompact/
rm "SF-Compact.dmg"
fi
fi
wget "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg"
hdiutil attach "SF-Mono.dmg"
if cd /Volumes/SanFranciscoMono/; then
if installer -pkg /Volumes/SanFranciscoMono/San\ Francisco\ Mono.pkg; then
cd ~/Downloads
hditutil detach /Volumes/SanFranciscoMono/
rm "SF-Mono.dmg"
fi
fi
wget "https://devimages-cdn.apple.com/design/resources/download/NY.dmg"
hdiutil attach "NY.dmg"
if cd /Volumes/NYFonts/; then
if installer -pkg /Volumes/NYFonts/NY\ Fonts.pkg; then
cd ~/Downloads
hditutil detach /Volumes/NYFonts/
rm "NY.dmg"
fi
fi
# Try out MAS CLI
brew install mas
mas signin [email protected] 'nice try'
# Pixelmator
mas install 1289583905
# Vectornator
mas install 1219074514
# The Unarchiver
mas install 425424353
# StopTheMadness
mas install 1376402589
# Final Cut
mas install 424389933
# Motion
mas install 434290957
# Harvest
mas install 506189836
# Slack
mas install 803453959
# 1Blocker
mas install 1365531024
# 1Password
mas install 1333542190
# Xcode
mas install 497799835
###############################################################################
# Kill affected applications #
###############################################################################
for app in "Activity Monitor" "cfprefsd" "Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer"; do
killall "${app}" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment