Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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...$?

share|improve this question

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 Liljenberg 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 Liljenberg Feb 13 '12 at 6:16
add comment

2 Answers 2

up vote 7 down vote accepted

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
share|improve this answer
    
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
    
Thank you, nduplessis. It looks like this is correct. –  nbkincaid Feb 13 '12 at 1:12
    
Tim, what do you mean by this? –  nbkincaid Feb 13 '12 at 1:12
show 1 more comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.