Mac terminal says "-bash: echo: write error: Broken pipe" on opening I opened my terminal, like I do most days Mon-Fri, and was surprised to see this error:

Last login: Fri Jul 27 17:19:25 on console
-bash: echo: write error: Broken pipe
SomeMac:~ user568458$ 


Everything seems to work fine currently, but things like this worry me because they could be a clue that something is wrong which might blow up later.

Doing some searches suggests that this message can appear if someone introduces an error into .bash_profile - but I haven't modified that file in a long time and haven't installed anything that would modify it recently. In fact, my .bash_profile file reports its "Modified" date as February (5 months ago).

How can I investigate what caused this or how serious it is? Or is it something that can be safely ignored?



In case it's relevant, since that other linked Q&amp;A mentions .bash_profile commands related to NVM (which I do use), here's the contents of my .bash_profile file:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] &amp;&amp; \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] &amp;&amp; \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion


But this doesn't include the infinite-loop causing line source ~/.bash_profile in that other guy's answer, and these have (as far as I can) not changed since February, so I'm not sure how they could be the cause of the error.
A shell's error message is really straight forward. The structure consists of the command, the filename, and the error message.

command: filename: message


Your error message is a bit more complicated in the fact that you are using  a shell builtin command and the filename is a stream through a pipe. So, my best guess would be that somewhere in nvm.sh, there is a line that is something like echo something | command, where command is closing the pipe before echo finishes sending the data.