Skip to content

Instantly share code, notes, and snippets.

@timsutton
Created November 21, 2014 12:07
Show Gist options
  • Save timsutton/55d4a874047d58fada16 to your computer and use it in GitHub Desktop.
Save timsutton/55d4a874047d58fada16 to your computer and use it in GitHub Desktop.
Set a computer name that contains the last half of the MAC of the "Ethernet" network service
mac_portion=$(networksetup -getmacaddress Ethernet | egrep -o "([0-9a-f]{2}:){5}[0-9a-f]{2}" | cut -f 4-6 -d ':' | tr -d ':')
sudo scutil --set ComputerName "travis-${mac_portion}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment