"ComputerName: not set" message on startup #2155

Closed
JJJollyjim opened this Issue Oct 10, 2013 · 12 comments

Comments

Projects
None yet
7 participants

Since a recent update, I have been getting a ComputerName: not set message whenever I start a new shell:

ComputerName: not set

The error occurs in iTerm and the built-in Terminal. I'm on the latest oh-my-zsh, and this zsh version:

~ $ zsh --version
zsh 4.3.11 (i386-apple-darwin12.0)

From what I had seen, that one is caused by the following line in oh-my-zsh.sh and was changed in d2fe03d

That seems to be the cause: if I run scutil --get ComputerName I do get this error. echo ${HOST/.*/} prints localhost for me, which I assume is what should be coming from scutil. My $SHORT_HOST is empty.

By the way, I just updated from Apple's zsh (4.3.11) to brew's (5.0.2), and it still shows this message.

ismailasci pushed a commit to ismailasci/oh-my-zsh that referenced this issue Oct 19, 2013

The quick fix is scutil --set ComputerName "<computer name>".

That works well, the errors have stopped. That pull request looks good though.

ryh referenced this issue Nov 10, 2013

Christian Höltje
Create the zcompdump based on version and host
This will prevent lots of subtle problems that happen when
people upgrade ZSH or use NFS mounted home directories.

The ZSH_COMPDUMP variable can also be used to implement `zcompile`
and other fun features in the future.

Just posting to say that this issue still exists. Used the command that @teddyknox wrote above, seems to have fixed it, at least for now.

☁ ~ zsh --version zsh --version zsh 5.0.2 (x86_64-apple-darwin13.0)

Contributor

docwhat commented Apr 23, 2014

@davidnknight and @jj56

How did you get a Mac up without setting your ComputerName? I want to understand how this happened so I can fix the code correctly.

Thanks.

Contributor

ncanceill commented Apr 23, 2014

Well technically a simple sudo scutil --set ComputerName "" will have this effect.

Contributor

docwhat commented Apr 23, 2014

@ncanceill Thanks! Now I can reproduce the problem. I have a fix that falls back to the default. I'll push it up momentarily. Do you think I should check LocalHostName first before going back to the default?

docwhat pushed a commit to docwhat/oh-my-zsh that referenced this issue Apr 23, 2014

Christian Höltje
Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183
Contributor

ncanceill commented Apr 23, 2014

No.

The manual page scutil(8) says:

LocalHostName The local (Bonjour) host name.

But according to an Apple article about Bonjour hostnames:

If you enter a name that is already in use on your subnet, a numeral will automatically be added to distinguish it from the original. This change may not appear in the Sharing preference pane immediately. Example: If "mycomputer.local" is already on the network and you try the same name, your computer would automatically be renamed to "mycomputer2.local".

So LocalHostName may change when switching networks, eg if alice.local joins a network where alice.local already exists.

Contributor

docwhat commented Apr 23, 2014

That's what I thought, but the man page wasn't descriptive enough about any of this. Thanks.

evacchi commented Jul 21, 2014

Hi, this is still a problem on my machine; I am patching oh-my-zsh.sh manually (I have commented out the offending if), and I stash the change at each update. #2743 seems to fix this in the best way (redirects stderr to /dev/null) can it be merged?

docwhat added a commit to docwhat/oh-my-zsh that referenced this issue Jul 23, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

@robbyrussell robbyrussell closed this in #2743 Sep 3, 2014

hoggarth added a commit to hoggarth/oh-my-zsh that referenced this issue Sep 4, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

swanandp added a commit to swanandp/oh-my-zsh that referenced this issue Sep 15, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

ArjenSchwarz added a commit to ArjenSchwarz/oh-my-zsh that referenced this issue Sep 16, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

gsemet added a commit to gsemet/oh-my-zsh that referenced this issue Sep 17, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

mohitsethi added a commit to mohitsethi/oh-my-zsh that referenced this issue Oct 2, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

noj added a commit to noj/oh-my-zsh that referenced this issue Nov 4, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

benjaoming added a commit to benjaoming/oh-my-zsh that referenced this issue Nov 28, 2014

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

kenton added a commit to kenton/oh-my-zsh that referenced this issue Jan 9, 2015

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

hbpoison added a commit to hbpoison/oh-my-zsh that referenced this issue Aug 14, 2015

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183

NobbZ added a commit to NobbZ/oh-my-zsh that referenced this issue May 15, 2016

Trust but verify 'scutil' to return ComputerName
Apparently, it is possible to set up a Mac such that
`scutil --get ComputerName` hasn't been set.

This change checks if that fails and falls back to the original
mechanism.

Closes #2155
Closes #2183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment