Skip to content

Instantly share code, notes, and snippets.

@vsivsi
Created May 21, 2017 00:20
Show Gist options
  • Save vsivsi/589397df1b25c450127313201d8d3c40 to your computer and use it in GitHub Desktop.
Save vsivsi/589397df1b25c450127313201d8d3c40 to your computer and use it in GitHub Desktop.
Mac OS post install
# Run this file once. It will restart to finish the MacOS update
# If the developer tools are already installed, it does nothing. So it is safe to run it again.
# Get the names from HOSTNAME env, which comes from DNS reverse lookup
sudo scutil --set ComputerName $HOSTNAME
sudo scutil --set HostName $HOSTNAME
sudo scutil --set LocalHostName $HOSTNAME
# This sets the system clock to UTC, although the System Preferences UI won't show it.
# sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# This seems better than the above...
sudo systemsetup -settimezone GMT
# This disables the Wifi Network
networksetup -setairportpower en1 off
# This enables SSH Logins
sudo systemsetup -setremotelogin on
# This enables screen sharing
sudo defaults write /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled -bool false
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
# This system should never sleep
sudo systemsetup -setcomputersleep Never
sudo systemsetup -setharddisksleep Never
sudo systemsetup -setdisplaysleep 15
sudo systemsetup -setrestartpowerfailure on
defaults write -g KeyRepeat -int 5
defaults write -g InitialKeyRepeat -int 15
defaults write -g com.apple.mouse.scaling 2.5
if xcode-select -print-path &> /dev/null
then
echo "XCode CLI tools already installed"
else
# This magical file tells softwareupdate that its nonexistent CLI Tools install is out of date
sudo touch "/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
fi
softwareupdate -l
sudo softwareupdate -ia
sudo softwareupdate --schedule off
sudo chown admin /usr/local
sudo chgrp admin /usr/local
sudo reboot now
@dimitre
Copy link

dimitre commented Aug 26, 2024

Great one. I'm sharing mine here so maybe it is useful to others: https://gist.github.com/dimitre/e36afd57bce9bf2f8dce55d729628d08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment