This article will help you to update the name that shows up in your macOS terminal to whatever you like. You could have your own reasons to update it but just to let you know that it is not a big task anyway. It would take a few commands to be executed and you would have a terminal with the computer name that you like.

Rename computer alias in Mac Terminal

Rename computer alias in Mac Terminal

Just follow the steps we have mentioned below. It won’t take more than 5 minutes if you have a little experience working with the terminal in past. Let’s get started:

Update /etc/bashrc file if you would like to apply this changes for all users in your computer or elseĀ  ~/.bashrc for only your user account. You can use text editor of your choice like Vim or Nano or editor with user interface like TextEdit, Sublime, etc.

We have attached the commands that you can run if you would like to use terminal only. Just for your information, it would require a bit of knowledge to use them if you have never used them before.

This article won’t include in detail information because of it is out of this article’s coverage. The command given below will update the global terminal setting that will affect all users created in your computer.

sudo vim /etc/bashrc

or

sudo nano /etc/bashrc

Replace PS1=’\h:\W \u\$ ‘ with PS1 = ‘$ ‘ to set the computer name as just $ or you can use any word that you like.

If you would like to make use of the all parameters then we have given the whole breakdown as below:

  • h is the computer name
  • W is working directory
  • u is user and
  • $ is just a symbol you can set anything you want

Please keep in mind as soon as you save this file, the terminal will not start using your new settings. For that either you have to execute that file or restart your Terminal app.

If you would like to apply the changes then execute an appropriate command from commands given below:

source /etc/bashrc

or

source ~/.bashrc

Please let us know what kind of name you like to use in the comment section below with the queries that you have in your mind or the difficulties that you might have faced so that we can improve this article to help you and others.

Thank you and Stay Techie…