Connect Processes With a Named Pipe

Create a FIFO that lets unrelated processes exchange a data stream.

macOSbashautomationshellscriptingLow risk
Run mkfifo /tmp/p.pipe to create a pipe, then write with one process and read with another.

01Command

Command
$ mkfifo /tmp/demo.pipe; (printf 'hello\n' > /tmp/demo.pipe &); cat /tmp/demo.pipe

02What it does

A named pipe appears in the filesystem but carries a stream like an anonymous pipe, so two processes that cannot be joined with | can still communicate. It is used in shell automation to fan out data, coordinate jobs and stream between tools that only take filenames.

03Risk

RiskLow risk
RequirementsmacOS default zsh/bash (bash 3.2+; some features need bash 4+ via Homebrew)
CompatibilitymacOS with bash 3.2+ (GNU bash 4+ via Homebrew for advanced features)
!Warning: Opening a FIFO for reading blocks until a writer appears, which can hang a script; pair readers and writers carefully.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-10-13 · Category: Developer