Skip to main content

You can use the realpath or readlink commands to resolve a symbolic link's real/absolute path.

To get the full, resolved absolute path of a symbolic link:

```zsh
realpath /path/to/symlink
```

`realpath` follows chained symlinks and resolves `.` and `..` segments into a single canonical path.

## Helpful Alternatives & Flags

- **`readlink -f /path/to/symlink`**: Also recursively resolves all symlink components to an absolute path. Plain `readlink` (without `-f`) only shows the direct link target and can return a relative path or fail on non-symlinks.
- **In `zsh` (default macOS shell)**: Use the `:A` glob modifier to expand and resolve symlinks without spawning an external command:

```zsh
print -r -- /path/to/symlink(:A)
```