7

I haven't upgraded from macOS 12.6 to Ventura yet.

I have no realpath command in my /bin directory, or anywhere else on my M1 MacBook Air.

I've never installed brew/homebrew on my Mac though I've been told by other developers that brew can't install anything in /bin anyway.

But another developer who has upgraded to Ventura tells me there is a realpath in their /bin and it's signed with the Identifier com.apple.realpath

Can anybody confirm that realpath did not come with macOS Monterrey but has been added to macOS Ventura?

13
  • 1
    /bin/realpath is there in my Ventura on an M1 mini
    – mmmmmm
    Commented Nov 4, 2022 at 9:35
  • 1
    And on my Ventura Intel Macs. Since realpath is part of POSIX and macOS is POSIX compliant, I assume it has always been there (but maybe not).
    – Gilby
    Commented Nov 4, 2022 at 9:42
  • 4
    Interesting... I'm still on Monterey (Intel Mac) and can confirm that there is no command realpath.
    – jaume
    Commented Nov 4, 2022 at 10:09
  • 1
    And Homebrew installs it as /usr/local/bin/realpath Commented Nov 4, 2022 at 13:35
  • 2
    @jaume It's absent here on ARM Monterey, too. @glennjackman That's the path on Intel; on ARM Homebrew uses (by default) /opt/homebrew/bin/.
    – gidds
    Commented Nov 4, 2022 at 22:58

1 Answer 1

6

To the headline question: Yes.

On an Intel Mac (I can't see why an M1 Mac would be different):

  1. My macOS 13 has /bin/realpath.
  2. The executable has the same date and time as all other files in /usr/bin. Here is an ls snippet.
-rwsr-xr-x   1 root  wheel   203584 18 Oct 23:36 ps
-rwxr-xr-x   1 root  wheel   134064 18 Oct 23:36 pwd
-rwxr-xr-x   1 root  wheel   133840 18 Oct 23:36 realpath
-rwxr-xr-x   2 root  wheel   135424 18 Oct 23:36 rm
-rwxr-xr-x   1 root  wheel   133808 18 Oct 23:36 rmdir
  1. /bin is only on the sealed system volume, so nothing apart from a macOS install or update could have put realpath in /bin.
  2. I am a homebrew user, but there is no homebrew version of realpath:
% brew info realpath
Error: No available formula with the name "realpath".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.

Note that it is true (see @nohillside's comment) that realpath can be installed by brew as part of coreutils. I suggest caution with coreutils because of the potential for name clashes.

  1. @Barmar has commented above that realpath is in /bin on M1 Ventura.

  2. I have a copy of all macOS 12 man pages. There is no man page for realpath. (This is a slightly indirect way of saying not present in Monterey).

  3. There are new questions popping up on the web about realpath and Ventura. This also indicates that it was not installed previously.

I conclude that:

  1. realpath is part of macOS 13 on both Intel and AS.
  2. realpath was not in macOS 12.
  3. realpath is not in homebrew as a distinct item.
8
  • 2
    In Homebrew, realpath is part of coreutils (and it doesn't know about firmlinks). Does man realpath on macOS 13 imply that it does?
    – nohillside
    Commented Nov 5, 2022 at 21:37
  • 2
    man realpath says "The realpath utility uses the realpath(3) function to resolve all symbolic links...". No mention of firmlinks - so I assume not.
    – Gilby
    Commented Nov 5, 2022 at 21:46
  • 1
    The reason I'm delving into all this is because the Swift directory-walking functionality does not follow symlinks or firmlinks but I don't think we have its source to see its implementation. Rust's directory-walker does follow firmlinks, leading to duplicate traversals. Its realpath doesn't resolve firmlinks. Zig's dir-walker also follows firmlinks but its realpath does resolve firmlinks. I'm down the rabbithole trying to figure out which language's standard library might be missing what funcitonality. Commented Nov 6, 2022 at 6:14
  • 1
    @hippietrail It‘s in the nature of firmlinks that standard unix library functions are not aware of their existence. But in general, questions about how library handle firmlinks are better suited for StackOverflow.
    – nohillside
    Commented Nov 6, 2022 at 7:50
  • 1
    @nohillside: Yes I'm asking programming questions about the realpath() standard library function on StackOverflow but questions about the macOS version of the realpath shell command here. Sometimes I post a bit of explanation in case people think I'm asking an X/Y question. Commented Nov 6, 2022 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .