Change your Mac Hostname via Terminal

For most people if you want to change your Mac computer name you just do it through the Sharing system preference, it’s quick and very easy. For those of us that are more geekishly inclined, we like to do things through the Terminal.

Here’s how to change your Mac hostname with the command line and make it permanent:
scutil –-set HostName new_hostname
Simply replace new_hostname with whatever you want your hostname to be changed to, for example I want to change my Mac’s hostname to MacBookPro, I will use this command:
scutil –-set HostName MacBookPro

(Note the “–” before set is two dashes next to each other, –set)

You will be asked for your admin password since you’re using the sudo command. After the command is executed you can verify that the changes took place by typing:
hostname

You can also set a temporary hostname change by using the following command:
sudo hostname new_hostname
This will reset itself after your Mac reboots though, so if you want a permanent hostname change, use the above command instead. Thank you to commenter Jim for pointing this out!

That’s all there is to it. By default Mac OS X will usually assign the hostname as whatever the admin account username is. Changing your Mac’s hostname can make it easier to find your Mac on a network and to connect to.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值