Valet is a very useful tool for setting up a local environment, however it can break due to an update to itself or one of its dependencies, and simply removing it using composer won't be enough, here's how to do a full clean removal on MacOS.
Remove Valet
composer global remove laravel/valet
rm -rf ~/.config/valet
This will remove it from our global composer packages, and delete the existing configuration for it
Remove nginx
brew remove nginx
Then we need to remove all configurations on nginx
sudo rm -rf /opt/homebrew/etc/nginx
sudo rm -rf /opt/homebrew/etc/nginx/fastcgi.conf
sudo rm -rf /opt/homebrew/etc/nginx/fastcgi.conf.default
sudo rm -rf /opt/homebrew/etc/nginx/fastcgi_params
sudo rm -rf /opt/homebrew/etc/nginx/fastcgi_params.default
sudo rm -rf /opt/homebrew/etc/nginx/koi-utf
sudo rm -rf /opt/homebrew/etc/nginx/koi-win
sudo rm -rf /opt/homebrew/etc/nginx/mime.types
sudo rm -rf /opt/homebrew/etc/nginx/mime.types.default
sudo rm -rf /opt/homebrew/etc/nginx/nginx.conf
sudo rm -rf /opt/homebrew/etc/nginx/nginx.conf.default
sudo rm -rf /opt/homebrew/etc/nginx/scgi_params
sudo rm -rf /opt/homebrew/etc/nginx/scgi_params.default
sudo rm -rf /opt/homebrew/etc/nginx/servers
sudo rm -rf /opt/homebrew/etc/nginx/servers/lasalle.conf
sudo rm -rf /opt/homebrew/etc/nginx/uwsgi_params
sudo rm -rf /opt/homebrew/etc/nginx/uwsgi_params.default
sudo rm -rf /opt/homebrew/etc/nginx/valet
sudo rm -rf /opt/homebrew/etc/nginx/valet/valet.conf
sudo rm -rf /opt/homebrew/etc/nginx/win-utf
Remove dnsmasq
brew remove dnsmasq
PHP version
Make sure php is set up, you can verify by running php -v
, if not you can install it using brew, brew install php@8.0
for a specific version, or just brew install php
for the latest
Installing Valet again
Now that we've done a wipe of valet, we need to install it again
brew install nginx # installing nginx again
composer global require laravel/valet # installing valet again
sudo valet install # setting up valet
Now it should be up and running correctly, you can use sudo valet
to verify, and you can link your repos correctly using sudo valet link my_repo
or parking an entire directory using sudo valet park ~/my-projects