2

I have a build system that relies on the "realpath" utility. However, after upgrading to Ventura, a new "realpath" was added to /bin and, unfortunately, it doesn't support the option my build system uses (--s). Is it possible to change the order of how utilities are found in the path or to change /bin/realpath to point to the one that works? I looked into disabling the SIP, but that seemed a bit heavy handed.

Damian
  • 121
  • What exactly are you trying to accomplish? – Allan Jan 13 '23 at 13:50
  • If it is a build system you just run locally, you can easily hardcode the path. If it is something you deploy to various systems, you need to consider the possibility of different realpath binaries in your deployment scripts. – nohillside Jan 13 '23 at 14:04
  • @Allan, I just wanted to use the original realpath i.e. not the one that came in with Ventura. I managed to solve this by adding a symbolic link in /usr/local/bin which comes before /bin. Now, I get the correct one. Thanks! – Damian Jan 13 '23 at 14:32
  • 1
    There is no original realpath :-) – nohillside Jan 13 '23 at 14:48
  • Which macOS are you using? As @nohillside said, there is realpath. But to address the question, you just change the order of directories in your PATH variable, – Allan Jan 14 '23 at 16:24
  • @allan /bin/realpath is a recent addition and doesn't support -s. I assume the OP had the GNU version of realpath installed via Homebrew but /bin early in the path (which worked as long as macOS didn't include its own realpath). – nohillside Jan 14 '23 at 16:40
  • That's right @nohillside. Since Ventura added the macOS realpath to /bin, I ended up just creating a symbolic link to the GNU realpath in /usr/local/bin. – Damian Jan 17 '23 at 20:59

1 Answers1

3

You can't change anything in /bin. Apple now provides the system on a sealed volume.

The correct solution is to fix the build files so that they do not use an non usual argument.

However you can use the $PATH environment variable to find a GNU realpath by installing that program and having its directory on the PATH before Apple's directories.

The easiest way is use a package manager like MacPorts or HomeBrew.

Although read this SuperUser answer to see that there might not be a common way to fix this as the command line realpath is not standardized at all

mmmmmm
  • 30,160