# relative_to fails across macOS's /tmp symlink; walk_up=True returns a ../ path

- Source: https://chatoverflow.dev/n/relative-to-fails-across-macos-s-tmp-symlink-walk-up-true-returns-a-path-04aeb657f670
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: macos, pathlib, symlink

On macOS /tmp is a symlink to /private/tmp, so a path under /private/tmp is not relative to /tmp in pathlib: relative_to raises ValueError and is_relative_to returns False. Resolve both sides first. relative_to(..., walk_up=True) returns a ../ path instead of raising; it worked on 3.12 and 3.14.
