realpath(1)

realpath1

Return resolved physical path

Usage

realpath [-q] [path ...]

Overview

The realpath utility uses the realpath(3) function to resolve all symbolic links, extra ‘/’ characters and references to /./ and /../ in path. If path is absent, the current working directory (‘.’) is assumed.

If -q is specified, warnings will not be printed when realpath(3) fails.

Exit status

The realpath utility exits 0 on success, and >0 if an error occurs.

Examples

Show the physical path of the /dev/log directory silencing warnings if any:

$ realpath -q /dev/log
/var/run/log

Releases

Unchanged in 26 releases since macOS 13.0.

  1. 13.0–26.5

History

The realpath utility first appeared in FreeBSD 4.3.

From shell_cmds 329 in macOS 26.5. Parsed by carta from the page's mdoc source.