Currently Being ModeratedJan 1, 2012 6:41 PM (in response to MouthBreather)
bacause .bashrc is ONLY excuted when starting a sub-shell. It is NOT execute when starting a login shell.
bash when run as a login shell will look for one of the following initialization scripts and use the first one it sees:
Other bourne shell variations will also use .profile if they do not fine their personalized flavor of initialization script.
Currently Being ModeratedJan 2, 2012 9:34 AM (in response to MouthBreather)
And FWIW, use your preferred Internet search engine to look for the various previous discussions of setting the bash prompt with the PS1 environment variable. For common questions, that's usually going to be faster than postings to the forums.
You're swimming in the deep end of the pool here with Unix command-level operations, and errors here can lead to nasty problems; make sure you have complete and trusted backups, and investigate the advice you are being given.
Two common errors - bash commands are very sensitive to the syntax (adding a space into the wrong spot in an rm deletion command is a classic) leading to untoward outcomes, and it's common for new folks to encounter problems with a mis-set PATH variable. (Search for details of that; BobHarris and others have posted on recovering from that.) And have a second privileged login available while you're experimenting, as that can allow you to access and correct the setting of the first (errant) login.
Here are three common manuals for learning more about the command line. While bash is consistent, some of the commands may or may not be available in any particular Unix, and there are some differences between the versions of bash that are in use. Put another way, not all of the following documentation will be correct for Mac OS X and Mac OS X Server:
Currently Being ModeratedJan 3, 2012 6:48 PM (in response to MrHoffman)
Thank you MrHoffman for the bash links. For now I'd be happy to get my prompt to come up the way I want instead of dynamically fixing it each time I run Terminal.
I'm not quite a novice with *nix, but the iMac is new to me. Imagine my pleasant surprise to discover both Perl and Python installed. I do custom Perl and MySQL development and had been working on a windoze box. The move to the iMac is more for my photography, but it is nice to see some tools to work with. I'll check those links for sure though.
Currently Being ModeratedJan 5, 2012 9:36 AM (in response to MouthBreather)
Make the change to your login to add the PS1 prompt symbol.
Make the change in whichever ONE of the following three files you have; if you have one of the following (visible via "ls -al" command), then use it. If you have more than one of these files, then consolidate the contents into one of the three files. (Multiple different login files are NOT honored.)
Pick the display value for PS1 to include something other than the DNS-derived host name your local DNS is serving up, either from your ISP or (more likely) from your gateway router (via its DNS or via its LAN-local DHCP server).
At worst, restart Terminal.app.
Better, swap the gateway router for a different one, and see if that resolves this.
Here is an earlier (and archived, and slightly stale) discussion of this behavior. (Use scutil to change your local host name with some caution; that's NOT likely a factor here. Definitely look at the gateway-router and the local IP network here; that definitely looks confused.)
And FWIW, Microsoft Windows, Perl and MySQL experience means little here; those are different platforms than is Unix and bash.
And FWIW, the following .profile extract from one of the production servers here contains a PS1 that sets the prompt string (the full DNS host, based on the \H) to red text:
PS1="\[\e[1;31m\]\u@\H $\[\e[0m\] "
Currently Being ModeratedJan 5, 2012 6:36 PM (in response to MrHoffman)
MrHoffman, you are a well of knowledge and inspiration. Thank you. None of the 3 profile files were here, and I have therefore created all 3 since none of them seem to make any difference to my prompt. Now I will delete 2 of them (since they all contain the same single line entry). I have been using 'sudo nano [filename]' to do this - is that the correct procedure?
I'll try your suggestions if the simple fix doesn't seem to work. Thank you again.
Currently Being ModeratedJan 5, 2012 6:53 PM (in response to MouthBreather)
Nano is fine, however, you should not be using sudo as that will make root the owner, and not you.
.profile is the least common denomator for bourne derived shells. .bash_profile is the first file bash looks for. You are welcome to choose to keep any of the 3 files.
Currently Being ModeratedMay 1, 2012 11:44 PM (in response to MouthBreather)
Hi I have a similar proble. I am using lion on MBP. When I connect to my home wifi network it shows my default computer name which is good. But then after a while it changes to this:
Last login: Sun Jun 5 15:27:51 on ttys000
I have tried do a fresh instal of OSX and had no success at all just keeps coming up with this some guy. I then logged into my wifi router settings and the Network is called some-guy andthe mac address does not appear to be the mac address of my computer.
Is this some one monitoring me?
What is it? I changed the password on my router and everything but didnt work.
Currently Being ModeratedMay 2, 2012 4:41 AM (in response to cheesebell)
Assuming System Preferences -> Sharing -> Computer name does not say "some-guy", then as has been mentioned several times in this thread, the problem has nothing to do with your Mac OS X installation, and everything to do with your DNS server, which could be your router and/or your ISP's DNS server.
So either change your PS1 prompt as discussed in most of the replies to this thread, or change your DNS server in System Preferences -> Network -> Advanced -> DNS -> [+]
You can use something like OpenDNS or Google DNS servers if you like
After entering one of these, drag it to the top of your list. Any grayed out DNS servers in the list are from your DHCP setup and will come after any you enter.
Personally, I just modify my PS1 prompt to be exactly what I want.
Currently Being ModeratedMay 2, 2012 5:50 AM (in response to cheesebell)
Do you have to put both rows of numbers in?
DNS uses the first server in its list. It will not even look at the 2nd unless the first one times out (30 seconds to a minute). The 3rd will not be looked at until the 2nd times out. DNS stops if the 3rd server does not respond.
You can click and drag a DNS server to the top of the list so it is the first server checked.
Again if you have grayed out entries, these came from your DHCP server that gave you your IP address, but as far as I know, the anything you enter will take priority.
Currently Being ModeratedMay 2, 2012 6:51 AM (in response to cheesebell)
If you set your DNS to something other than what your DHCP server is providing on a laptop, you'll have to adjust the setting (or use the Locations mechanism) when you move from site to site.
Otherwise, you can end up with DNS problems at other locations, particularly if you (for instance) connect to a network with private DNS set-up, or into a network that uses DNS as a content filter or such.
Depending on the particulars of the network you are connecting to, having the wrong DNS server configured (such as a hard-set value, or with the wrong location set) can be a fairly subtle error and can sometimes look like a network outage.
If you change your prompt using PS1, that will work everywhere.
Currently Being ModeratedMay 2, 2012 7:36 AM (in response to cheesebell)
If you never take your Mac to work (where maybe they have a corporate firewall and a private in-house network with their own private DNS servers), then using OpenDNS or Google DNS servers will most likely never cause you problems.
HOWEVER, MrHoffman is correct that if you do need to use your Mac in a place that has a private network AND you need to access those private systems by name, then locking your DNS server to OpenDNS or Google DNS will be an issue.
If you wish to change your PS1 prompt, just read the rest of the entries in this thread. Or search the forum for "PS1" and you will find any number of other posts where instructions are given on changing your PS1 prompt.
Short answer. Use your Terminal and the 'nano' editor to create a .bash_profile
Add something like the following to the file:
PS1='$(networksetup -getcomputername):\W \u\$ '
Restart your Terminal session, and now you should have the name you gave your computer in System Preferences -> Sharing -> Computer name
If something goes wrong, use "ls -a" to see the .bash_profile, and use 'nano' to edit it, or if there is nothing but you PS1 entry in it, you can "rm ~/.bash_profile" to remove it and you can start again.MacBook Pro, Mac OS X (10.7.3), 27" iMac, MacBook, MacMini, etc...