0

I just updated macOS to Mojave, updated brew and reinstalled php (version 7.3, still via brew).

If I run php I get

-bash: /usr/local/opt/php@7.2/bin/php: No such file or directory

But if I do which php I get

/usr/bin/php

(that php -v reports as 7.1.23)

Makes no sense. Why does php calls a path different reported by which?
And how can I make the system use the last version rather than those wrong ones?

I tried to brew unlink php && brew link php but when I run php it still calls the version 7.2 instead of the 7.3 that I just installed.

1 Answer 1

0

In my case the issue was with the /usr/local/bin appearing in PATH environment variable after /usr/bin (reported by brew doctor).

I fixed easily adding

export PATH="/usr/local/bin:$PATH"

to .bash_profile (or .bashrc) in the user home directory.

Don't really like the solution since I'd like to know why /usr/bin comes before /usr/local/bin (that, in macOS, is supposed provide the chance to override the paths) in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.