The thing is that when using external tools in PHPStorm and launching command starting with php ... it automatically refers to /usr/bin/php and there's no way I can change it. I would have to run /usr/local/opt/php56/bin/php ... which I would rather not do.

So is there any way I can e.g. symlink that default php file so homebrew php is really default?

2 Answers 2


I don't know PHPStorm and the way how does it launch php, but two common ways to manage your binaries execution in unix-like systems are:

  1. set correct PATH variable order: export PATH=/usr/local/opt/php56/bin/:$PATH

  2. use aliases alias php='/usr/local/opt/php56/bin/php'

The first solution will expose not only php but also other binaries in your custom php to be used as first, the second one modifies only usage of php binary.

Put one of the entries in your profile.


You need to make brew locate the packages installed by ensuring that the PATH environment variable (echo $PATH) contains /usr/local/bin.

Also it is necessary that /usr/local/bin appears in PATH before the occurrence of /usr/bin/. Because the first one is used for local overrides, allowing you to first encounter your local files before locating the default ones under /usr/bin.

On my MacBook this was not happening. I had the PATH constructed already somewhere, that I couldn't control in my .bash_profile, and the order was inverted.

The solution for me was to duplicate [*ughly*] the occurrence, being sure that /usr/local is prepended rather than appended:

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

(anywhere in .bash_profile or .bashrc, in your ~ home directory)

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.