Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Tyler23

macrumors 603
Original poster
Dec 2, 2010
5,664
159
Atlanta, GA
Hey everyone, I have an issue with Terminal..a few months ago I was just running some commands..somehow I deleted everything from terminal, and wasn't able to run any more commands.

Somehow, I got the functionality back by my address (whatever it's called..dunno the lingo), has changed..

here's what I see now:

Last login: Thu Dec 9 18:22:30 on ttys000
new-host-2:~ tylerclifford$ defaults write com.apple.Safari


It says new-host-2: now, instead of just saying my name (which is what it did before).

How did this happen, is it a problem, and how can I get it back to how it used to be?
 
In Terminal enter the following:

Code:
scutil --get HostName; scutil --get LocalHostName; scutil --get ComputerName
and post the output.
 
It looks like the prompt was changed. You can change it by adding the following to either the .profile or .bash_profile file in your home directory (may not exist yet and is invisible).
Code:
export PS1=":\w \u> "
 
It looks like the prompt was changed. You can change it by adding the following to either the .profile or .bash_profile file in your home directory (may not exist yet and is invisible).
Code:
export PS1=":\w \u> "

Thanks. The default is PS1='\h:\W \u\$ ' I suspect this is what the OP had, but he has only noticed the host name now since it has changed.
 
In Terminal enter the following:

Code:
scutil --get HostName; scutil --get LocalHostName; scutil --get ComputerName
and post the output.

Before I forget, thanks for helping me with this! It's been bugging me..

Here's the outup:


new-host-2:~ tylerclifford$ scutil --get HostName; scutil --get LocalHostName; scutil --get ComputerName

HostName: not set
tyler-cliffords-macbook-pro-3
Tyler Clifford’s MacBook Pro (3)
new-host-2:~ tylerclifford$
 
new-host-2:~ tylerclifford$ hostname
new-host-2.home


I don't really know anything about this, but even I think this is weird..and I have no idea how I did this to the Terminal.
 
What do you get from

Code:
dscacheutil -cachedump -entries host

in Terminal?
 
new-host-2:~ tylerclifford$ dscacheutil -cachedump -entries host

DirectoryService Cache Overview:
AAAA Queries - Disabled (link-local IPv6 addresses)
Cache Size - 8

Entry count by category:
Group - 3
Service - 1
User - 4

Cache entries (ordered as stored in the cache):

Category Best Before Last Access Hits Refs TTL Neg DS Node
---------- ------------------ ------------------ -------- ------ -------- ----- ---------
 
Well, let's reset that hostname.

In Terminal, enter

Code:
sudo scutil --set HostName tyler-cliffords-macbook-pro

You'll need to enter your password when asked. Then quit and restart Terminal.
 
it's not letting me type anything in? it asked for the password in the output but I'm not able to type anything within Terminal.
 
well not sure what the problem was but I went to Shell --> New Command, re-entered the command you gave me and was able to type the password (although it displayed nothing as I was typing).

this is what I see now:

Last login: Thu Dec 9 20:22:06 on ttys000
tyler-cliffords-macbook-pro:~ tylerclifford$

does that seem about right?
 
well not sure what the problem was but I went to Shell --> New Command, re-entered the command you gave me and was able to type the password (although it displayed nothing as I was typing).

this is what I see now:

Last login: Thu Dec 9 20:22:06 on ttys000
tyler-cliffords-macbook-pro:~ tylerclifford$

does that seem about right?

That seems fine. You can use

Code:
sudo scutil --set HostName tyler-cliffords-macbook-pro

again should the problem return. (You can also set the hostname to something else just by changing the text after the word HostName in this command.)

You can also customize the prompt as suggested by angelwatt, so that the hostname doesn't appear at all.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.