Skip to content

Instantly share code, notes, and snippets.

@mikfreedman
Last active January 19, 2017 21:14
Show Gist options
  • Save mikfreedman/10294278 to your computer and use it in GitHub Desktop.
Save mikfreedman/10294278 to your computer and use it in GitHub Desktop.
rename machine
hostname=ENV['HOSTNAME']
[
"scutil --set ComputerName #{hostname}",
"scutil --set LocalHostName #{hostname}",
"scutil --set HostName #{hostname}",
"hostname #{hostname}",
"diskutil rename / #{hostname}" ].each do |host_cmd|
`#{host_cmd}`
end
@gudatcomputers
Copy link

Hey why don't you get the file type right! .sh -> .rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment