Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"env: php: No such file or directory" on new mac OS Monterey

i've updated my mac os to Monterey (12) and then I can not use composer command or php command and get this error

env: php: No such file or directory
like image 465
Hassan Avatar asked Nov 24 '25 02:11

Hassan


2 Answers

macOS 12 (Monterey) removes the system provided PHP and you will need to install it yourself.

It is easy to install if you have brew installed. Simply run the following:

brew install [email protected] brew-php-switcher
brew link [email protected]

This will install the latest version of PHP 7.4 as well as a handy utility for switching between PHP versions if you need to.

like image 179
Aj Maurya Avatar answered Nov 26 '25 14:11

Aj Maurya


PHP has been removed from MacOS since v12 (Monterey), so you first need to install it on your own to use it. From my POV, the easiest way to do this is using Homebrew

like image 24
Nico Haase Avatar answered Nov 26 '25 15:11

Nico Haase



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!