Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

behnampmdg3's avatar

brew update, now nothing works

Hello;

php artisan was working fine. I did a brew update and now I get:

php artisan serve 
-bash: /usr/local/bin/php: No such file or directory

How can I fix this?

Thanks

0 likes
8 replies
MaverickChan's avatar

run php -v in your console , what does it show?

mostly , you didn't install php right.

behnampmdg3's avatar

Hi;

I didn't install anything. I just updated brew.

Here is what I get

run php -v 
-bash: run: command not found
which php
/usr/bin/php
drjd's avatar
drjd
Best Answer
Level 3

It looks like something may have gone wrong during the update resulting in PHP no longer being installed through Homebrew, or at least no longer being found.

Running brew doctor will show you if anything has gone wrong with Homebrew in general. If everything is fine it should return Your system is ready to brew.

You can check if PHP is still installed through Homebrew by running brew list and checking the results, or brew list | grep php for quickness. If you do see PHP installed then note the package name exactly, it could be php or it could be [email protected] if you've installed a specific version before.

If you do find that PHP is installed, run brew uninstall php (replacing the exact package name as applicable) followed by brew install php for a fresh install.

In most cases this should be enough to then run php -v and see that you're hitting the Homebrew installed package which right now is version 7.2.11

1 like
behnampmdg3's avatar
brew doctor 
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You are using macOS 10.10.
We (and Apple) do not provide support for this old version.
You will encounter build failures and other breakages.
Please create pull-requests instead of asking for help on Homebrew's
GitHub, Discourse, Twitter or IRC. As you are running this old version,
you are responsible for resolving any issues you experience.

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/etc/bash_completion.d/_brew_services


Behnams-MacBook-Pro-2:codes bj$ brew prune

Pruned 1 symbolic links and 3 directories from /usr/local

Behnams-MacBook-Pro-2:codes bj$ brew doctor 
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You are using macOS 10.10.
We (and Apple) do not provide support for this old version.
You will encounter build failures and other breakages.
Please create pull-requests instead of asking for help on Homebrew's
GitHub, Discourse, Twitter or IRC. As you are running this old version,
you are responsible for resolving any issues you experience.
Behnams-MacBook-Pro-2:codes bj$ 

I'm gonna do php now.

behnampmdg3's avatar

Php is there, but still no artisan, or Laravel command

Behnams-MacBook-Pro-2:codes bj$ php -v
PHP 7.2.11 (cli) (built: Oct 19 2018 00:27:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.11, Copyright (c) 1999-2018, by Zend Technologies
Behnams-MacBook-Pro-2:codes bj$ php artisan 
Could not open input file: artisan
Behnams-MacBook-Pro-2:codes bj$  brew services start php
==> Successfully started `php` (label: homebrew.mxcl.php)
Behnams-MacBook-Pro-2:codes bj$ php artisan 
Could not open input file: artisan
Behnams-MacBook-Pro-2:codes bj$ 

drjd's avatar

Could not open input file: artisan would suggest there is no file named artisan in your current working directory.

Are you sure you’re running the command in the same directory as your Laravel app?

behnampmdg3's avatar

We are back to business. Thank you. I was not in the right directory.

What do you think is the best way I learn things like this? How did you know what to do?

With Laravel series I am making good progress with Laravel app itself. For example Queries, Models, Tinker, Validations, Artisan, OO, Eloquent, etc.

However, fixing things like what just happened, I don't feel like I m learning at all.

So what do you recommend I watch or read as a resource for terminal related subjects?

Thanks again

drjd's avatar

@behnampmdg3 The only way to learn things like this is by a mixture of trial and error, and Google. Sure, reading through the documentation of Homebrew would've let you know about some of the commands that are available, but documentation often lacks the real world context of when you would reach for those commands to fix something.

In your scenario I would have looked at the error message that was presented, in this case -bash: /usr/local/bin/php: No such file or directory, and asked myself what change could have produced this error. You recently updated PHP with Homebrew, and now it can't be found. Is it even installed? How do I check? Google "see homebrew installed packages" and it'll show me how to check. Maybe it would've shown me it wasn't installed, or maybe it was but clearly not working. Starting from scratch can't be a bad thing, so I would've Googled how to uninstall and reinstall a Homebrew package - this would've shown you the same instructions I wrote, more or less. Then, for your last error, a simple Google search would've shown that Could not open input file: artisan simply means the PHP interpreter can't find the input file, in this case named artisan.

Simply put, whenever fixing anything, Google is your friend. Rarely will you be the first person to experience the problem!

1 like

Please or to participate in this conversation.