mkfifo - macOS


The mkfifo command creates a named pipe (FIFO) in the specified location. A FIFO is a special file that behaves like a pipe but is accessible by name in the file system. It allows multiple processes to communicate with each other in a first-in, first-out (FIFO) manner.


mkfifo [-m mode] <fifo-file>


  • -m mode: Set the file mode (permissions) of the created FIFO. The default mode is 0600.


Creating a FIFO

To create a FIFO named my_fifo in the current working directory:

mkfifo my_fifo

Setting File Mode

To create a FIFO with mode 0777:

mkfifo -m 0777 my_fifo

Common Issues

Permission Denied

If you encounter a “Permission denied” error, ensure you have sufficient permissions to create files in the specified location.


FIFOs can be used with other commands, such as cat, tail, and head, to create simple communication pipelines. For example:

mkfifo my_pipe
cat my_file > my_pipe &
tail -f my_pipe

This command creates a FIFO named my_pipe, writes the contents of my_file to the FIFO using cat, and continuously displays the contents of the FIFO using tail.

  • pipe: Creates an anonymous pipe.
  • namedpipe: Creates a named pipe using the NamedPipe framework (not available on all macOS versions).