Skip to content

Instantly share code, notes, and snippets.

@aromig
Last active November 12, 2015 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aromig/d929525b63ec2552deea to your computer and use it in GitHub Desktop.
Save aromig/d929525b63ec2552deea to your computer and use it in GitHub Desktop.
# Get device names of network adapters
networksetup -listallhardwareports
# Get network service order
networksetup -listnetworkserviceorder
# List wireless SSIDs
networksetup -listpreferredwirelessnetworks <device>
# Get and Set search domains
networksetup -getsearchdomains <networkservice>
networksetup -setsearchdomains <networkservice> <domain1> <domain2> <domain3> <...>
# Clear DNS cache
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
# Get and Set Hostname
scutil --get LocalHostName
scutil --get ComputerName
scutil --get HostName
sudo scutil --set HostName <hostname>.<domain>
# Check if Remote Management is enabled
# First SSH to machine then run: (checks if daemon exists in /etc/ )
[[ -f /etc/RemoteManagement.launchd ]] && echo 'enabled' || echo 'disabled'
# Enable Remote Management
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -off -restart -agent -privs -all -allowAccessFor -allUsers
# Check if Screen Sharing is enabled
# First SSH to machine then run: (checks if daemon exists in /etc/ )
[[ -f /etc/com.apple.screensharing.agent.launchd ]] && echo 'enabled' || echo 'disabled'
# Enable Screen Sharing
sudo defaults write /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled -bool false
sudo launchctl load /System/Library/LaunchDaemons/com.apple.screensharing.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment