Skip to content

Instantly share code, notes, and snippets.

@audibleblink
Created March 27, 2014 18:03
Show Gist options
  • Save audibleblink/9814104 to your computer and use it in GitHub Desktop.
Save audibleblink/9814104 to your computer and use it in GitHub Desktop.
Sets host names based on HDD name
#!/bin/sh
# 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