basher
basher copied to clipboard
Fix: use which instead of type to check for realpath
For whatever reason, type -p realpath returns empty on macOS even though realpath exists, and so it defaults to using readlink -f which does not work on macOS.
Using which realpath seems to work better.
it works fine for me:
❯ type -p realpath
realpath is /usr/local/bin/realpath
Can you debug why this is happening? I'd rather not include a fix unless we can find the root cause.
it works fine for me:
❯ type -p realpath realpath is /usr/local/bin/realpathCan you debug why this is happening? I'd rather not include a fix unless we can find the root cause.
I'm not sure how much more I can do to debug:

You tried this on macOS? I'm on Big Sur. Maybe you were in a different OS version?
Why do you say realpath exists? It very likely comes from brew coreutils. Did you try running which realpath ?