Skip to content

Glossary

Mach port

A kernel-owned message queue addressed by capability. The IPC primitive every higher layer on macOS — XPC, launchd, signals — is built on.

A Mach port is two things at once:

  1. A message queue, owned by the kernel.
  2. A set of rights — capabilities to interact with that queue, held by tasks.

The queue lives in kernel memory. Userspace never touches it directly; it works through port rights stored in the kernel and exposed as opaque mach_port_name_t handles per task (looking and behaving suspiciously like file descriptors).

apple-oss-distributions/xnuosfmk/ipc/ipc_port.hipc_port — the kernel-side queue object.View on GitHub(line ) apple-oss-distributions/xnuosfmk/ipc/ipc_right.cThe functions that allocate, copy, and destroy port rights.View on GitHub(line )

The three rights you'll meet most often:

  • Receive right. Exactly one per port, ever. Whoever holds it dequeues messages.
  • Send right. Many tasks can hold one for the same port. Send messages by enqueuing them.
  • Send-once right. A single-use send right; common as a reply token.

See also: Mach, Mach message, task, and the long-form article on Mach ports and messages.