1

I have a question about my terminal. When I started out working with Rails on my Mac terminal, I would have lines that looked like this as the route for my $:

Nicholass-MacBook-Pro:sample_app nbkincaid$ rails console

But now, I get lines that look like this:

pal-nat184-103-166:desktop nbkincaid$

I'm pretty sure that I didn't change anything, so why does it give me the pal-nat....$ instead of the Nicholas...$?

migrated from stackoverflow.com Feb 12 '12 at 15:34

This question came from our site for professional and enthusiast programmers.

  • 1
    I'd say you've changed something or that your bash shell is set up to display the host name of your computer and you're on a network assigning you a name. – Peter Svensson Feb 12 '12 at 7:35
  • @PeterLiljenberg Instead of saying that in a comment, you should say that in an answer. – Jason Salaz Feb 13 '12 at 0:23
  • Thank you, Peter. It looks like when I log on to my school's wireless network, thats when I notice it, but when I'm on my wireless network at home, it reverts to my name. – nbkincaid Feb 13 '12 at 1:10
  • @jason well I guess :). glad to help – Peter Svensson Feb 13 '12 at 6:16
7

The string "pal-nat184-103-166" is your computer's hostname, which can be changed dynamically by routers or other network devices through DHCP.

If you want to set it to a static string, you can do so by adding the following line to /etc/hostconfig

HOSTNAME=Nicholass-MacBook-Pro
  • You should also check the Sharing preference pane to make sure you have your computer name set to what you want your machine to show up as on the network. – siannopollo Feb 12 '12 at 7:37
  • Add this to "questions I've always wondered about but never sought through to investigate why" – Tim Feb 12 '12 at 7:38
  • Also, confirmed that you can just change the setting in Sharing pref pane. – Tim Feb 12 '12 at 7:39
  • Tim, what do you mean by this? – nbkincaid Feb 13 '12 at 1:12
  • @nbkincaid Tim meant he's seen this problem and always wondered about it, but just fixed it and otherwise never cared to ask anyone about it. – Jason Salaz Feb 13 '12 at 6:36
-1

You probably messed up your ~/.bash_profile file.

Export the S1 shell variable.

For example, I have this one:

export PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

Remember to re-open the console after changing bash_profile file.

https://makandracards.com/makandra/1090-customize-your-bash-prompt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .