Skip to content

Instantly share code, notes, and snippets.

@CodeShane
Created May 6, 2016 16:22
Show Gist options
  • Save CodeShane/5b8b7b21d007b36a800c28dbbb7b2d19 to your computer and use it in GitHub Desktop.
Save CodeShane/5b8b7b21d007b36a800c28dbbb7b2d19 to your computer and use it in GitHub Desktop.
View or Change Local System Names on Mac OS X - OSX
#!/bin/sh
#
# View or Change Local System Names
#
# to view: ./name.sh
# to change: ./name.sh newname
# passwordless: sudo ./name.sh
#
if [ -z ${1+x} ]
# $1 is unset
then
echo HostName \(Terminal Prompt\) - generally "HostName: not set"
scutil --get HostName
echo LocalHostName \(Network\)
scutil --get LocalHostName
echo ComputerName \(Bonjour\) - generally the same.
scutil --get ComputerName
else
# Terminal Prompt
scutil --set HostName $1
# Network
scutil --set LocalHostName $1
# Bonjour
scutil --set ComputerName $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment