Question: ![enter image description here](https://i.stack.imgur.com/SKrWX.png)

I've gotten the "broken pipe" error from Xcode one time too many. I'm now curious to know exactly what a pipe is.

What is the concept of a "pipe" and how can it be "broken"?

Answer: 
The `|` character is often called a pipe. In the various UNIX shells (that I know of) it can be used to pipe the output of one command to the input of another.

```
cat myfile.txt | head

```

The `head` command only shows the first few lines of its input. At that point, it closes its input. This poses a problem for the command that was generating the input. Where does it write to? Whenever we have this situation, or the situation when the writing process ends before the reader is through, it's called a "broken pipe".

To prevent the `cat` command from lingering forever, the UNIX standard defines a special signal ([SIGPIPE](http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_10.html#tag_02_10_14), [signal 13](http://compute.cnr.berkeley.edu/cgi-bin/man-cgi?signal.h+3)) which it send to `cat`. The default action for this signal is to kill the process, which makes the `cat` end nicely.

It looks like the application you're using has installed a signal handler for all signals, including SIGPIPE, which creates the little popup message that you see.
A pipe is an IPC mechanism on Unix systems. A pipe has two ends, a read end, and a write end. Data that is written into the write end can be read from the read end and comes out in the order in which it was written.

In the Unix command line world, pipes are a very common way of hooking programs together to get a job done. For example `sed 's/foo/bar/g' fred.txt | grep -e 'bar.*baz'` will read in the file `fred.txt` replace all instances of the string `foo` with the string `bar` then search the result for lines that contain `bar` followed by some number of characters, then `baz`.

That, of course, doesn't seem terribly useful. But I'm sure if you think about it that you can see how you might be able to put that to all kinds of interesting uses, especially once you have programs like `awk` or `perl` at your disposal.

The pipe system has been a part of Unix from very early on. And if a process in your pipeline exits you usually want all the programs in the pipeline to exit. This means that, by default, a process that writes into a pipe were the process on the read end is gone will get a `SIGPIPE` signal. And if its blocked that signal, the `write` will still fail with a special kind of error indicating that the pipe has 'broken'.

The default handling of `SIGPIPE` kills the process that receives it. And if it isn't the 'head' of the pipeline, the whole `SIGPIPE` thing propagates back up the chain.

What Xcode is complaining about is that it started some sub-program to do something with a pipe leading to it, and that sub-program died unexpectedly leaving the pipe broken..