I'm trying to get Valet running on a new MacBook Pro running macOS 12.3. Homebrew, PHP, and Composer are all installed just fine and functioning (to the extent of my knowledge).
However, once I installed Valet and tried to ping foobar.test it's not returning 127.0.0.1 (it's some 198.#.#.# IP) and I cannot access it in my browser either. I get a ERR_CONNECTION_RESET message.
If I go to 127.0.0.1 or localhost directly in my browser, I get the "404 - Not Found" Valet message I'd expect.
Running brew services list, I get the following:
Name Status User File
dnsmasq error 512 root ~/Library/LaunchAgents/homebrew.mxcl.dnsmasq.plist
mariadb started root ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
nginx error 256 root ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
php started root ~/Library/LaunchAgents/homebrew.mxcl.php.plist
unbound error 256 root ~/Library/LaunchAgents/homebrew.mxcl.unbound.plist
The "error" statuses seem suspect, but I've been battling those for years on previous machines where Valet does work.
I've tried restarting my MacBook, restarting Valet (also as sudo), and removing/reinstalling Valet. Nothing seems to help.
Not sure what to try since nothing resulted in errors during installation. All community posts seem to point to reinstalling Valet, which as mentioned, doesn't seem to help.
Any ideas?
Uninstalled FortiClient and the issue went away. See if you have any VPN client or installed.
I previously had this issue and found out the root cause for those with FortiClient was it was enabling the pf firewall in OSX and having a NAT DNS Redirect.
To verify what I was seeing running sudo pfctl -s nat gave me a line containing:
rdr pass inet proto udp from any to any port = 53 -> 127.0.0.1 port 53535
If you require having FortiClient and also to use valet in local development there has been a couple of workaround found:
pf's configurationTo reset PF I would do the following:
# reset the rules based off the on-disk version
sudo pfctl -N -f /etc/pf.conf
# clear the DNS cache on system
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
After checking the NAT rules in pf I then get the default response of:
$ sudo pfctl -s nat
No ALTQ support in kernel
ALTQ related functions disabled
nat-anchor “com.apple/*” all
rdr-anchor “com.apple/*” all
NOTE: Resetting pf's config might have some other side-effects as part of it, though from my experience using it for the past month, it seems to work without any issues for my setup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With