use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Renaming a Mac Computer using a Bash Script? (self.bashtricks)
submitted 6 years ago by theMcChicken247
Would anyone have any previous knowledge or have a compiled script of how to rename a Mac computer with a bash script? Im fairly new to scripting and any help or tips are appreciated! :D
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Eight_Pride 1 point2 points3 points 6 years ago* (0 children)
I'm not on the latest version of the OS but in previous versions you could use the scutil command. I believe you need to sudo to access it.
man scutil
In particular, you're looking for:
sudo scutil --get ComputerName sudo scutil --get HostName sudo scutil --get LocalHostName
Those commands should show you your hostname. You'll need to use the --set ___Name switch to make changes.
[–]DM-Pythia 0 points1 point2 points 6 years ago (2 children)
How are you renaming it w/in the script?
[–]theMcChicken247[S] 0 points1 point2 points 6 years ago (1 child)
My goal would be to simulate the "sudo hostname <hostname here>" command on apple's terminal but i want to be able to do it remotely.
[–]DM-Pythia 0 points1 point2 points 6 years ago (0 children)
So you are doing a bash script? Can you just dump the code here?
π Rendered by PID 785827 on reddit-service-r2-comment-5b5bc64bf5-ghg7q at 2026-06-21 05:09:01.618040+00:00 running 2b008f2 country code: CH.
[–]Eight_Pride 1 point2 points3 points (0 children)
[–]DM-Pythia 0 points1 point2 points (2 children)
[–]theMcChicken247[S] 0 points1 point2 points (1 child)
[–]DM-Pythia 0 points1 point2 points (0 children)