basher icon indicating copy to clipboard operation
basher copied to clipboard

Fix: use which instead of type to check for realpath

Open josephschmitt opened this issue 4 years ago • 3 comments

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.

josephschmitt avatar May 14 '20 01:05 josephschmitt

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.

juanibiapina avatar Jan 04 '21 09:01 juanibiapina

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.

I'm not sure how much more I can do to debug: image

You tried this on macOS? I'm on Big Sur. Maybe you were in a different OS version?

josephschmitt avatar Apr 13 '21 20:04 josephschmitt

Why do you say realpath exists? It very likely comes from brew coreutils. Did you try running which realpath ?

juanibiapina avatar May 20 '21 18:05 juanibiapina