Skip to content

Instantly share code, notes, and snippets.

Created Mar 27, 2014
What would you like to do?
Sets host names based on HDD name
# Summary: Sets hostnames to volume name
set -o errexit
new_name=`diskutil list | grep "2:" | awk '{print $3}'`
sudo scutil --set ComputerName $new_name
sudo scutil --set LocalHostName $new_name
sudo scutil --set HostName $new_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment