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

Rainieren's avatar

Laravel Valet - Cannot ping, "Unknown host"

I recently got a MacBook and want to use Valet. I followed all the steps on the Laravel website but I cannot ping. If I do ping foobar.test I get "Unknown host"... I have been trying to fix this issue for this entire day but can't seem to find the answer anywhere. Even If I go to the site that I created called example. Example.test should return an echo but instead, it says "This site is not reachable" in chrome.

I'm really beginning to lose my patience. I think it has something to do with dnsmasq but I just don't know what. I have tried the following things

  • Remove valet entirely and install it again
  • Remove all services independently and installed them all again
  • Reinstall Composer.

I just don't get the problem. Also when I upgrade the php version from 7.2 to 7.4 using brew update php and try to run valet. It says unlinked php. even though it is linked.... I just don't know what to do.

Edit:

I opened the console and looked for dnsmasq and I get the following error:

failed to create listening socket for 192.168.178.23: Permission denied

But all my brew services are run as root So i don't get why it says permission denied

Also, whenever I do dig foobar.test I see no answer section

0 likes
27 replies
Nakov's avatar

@rainieren maybe something else is blocking the port 80, if you have MAMP or something else installed.

Rainieren's avatar

I Indeed had MAMP installed. I removed it and tried again. It still does not seem to work. I followed the videos @bugsysha said but it does not solve anything.

Nakov's avatar

@rainieren running:

lsof -i tcp:80

will it show nginx is holding that port, which means valet is in play, or something else :)

Try valet restart to restart the services.

screwtape_mk's avatar

@Nakov May you please elaborate what it is i should be expecting here i am seeing the following:

.compute-1.amazonaws.com:http (CLOSED)
update.utorrent.com:http (CLOSED)
compute-1.amazonaws.com:http (CLOSED)
Rainieren's avatar

@nakov Unfortunately, lsof -i tcp:80 does not return anything. Also, valet restart does not change anything. I added 127.0.0.1 to my DNS settings in System preferences > Network > Advanced > DNS hoping that will change anything but it does not. I did dig foobar.test but is does not show the ANSWER SECTION.

EDIT::

May it be the content of dnsmasq.conf at /etc/.valet/dnsmasq.conf?

Nakov's avatar

If nothing is returned then it means that the nginx is not started at all. Try starting the services using:

sudo brew services start
bugsysha's avatar

Disable MAMP if it runs on startup. Remove all related to Valet. Remove all services that came with Valet and MAMP. Restart computer. Make sure that nothing is running, if you find something that remained installed remove it and restart. Repeat until clear of junk. Install from scratch Valet with instructions from the documentation or videos here on Laracasts.

Rainieren's avatar

I uninstalled everything related to valet. I removed all brew services such as nginx, dnsmasq, mysql etc. and tried to do valet install again. It gave me an error and did brew doctor. This says that there are broken symlinks found and I think that is the issue. It says I have to do brew cleanup but then It gives me the error Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins

Rainieren's avatar

I fixed the issue but now I when I run composer global remove weprovide/valet-plus it says Installation failed, reverting ./composer.json to its original content.

Rainieren's avatar

I removed everything and started back from scratch with nothing. Followed every step in the right order and still have the original problem. I am running out of ideas to try

bugsysha's avatar

So you have removed that global composer package?

Nakov's avatar

@rainieren and did you parked valet in a directory with projects?

valet links shows that you have the urls that you are trying?

Rainieren's avatar

valet links return no urls and I have removed the global package

Nakov's avatar

@rainieren so did you parked valet within a folder with projects?

valet park?

Or inside the project folder run:

valet link projectname

and access it as projectname.test in your browser

bugsysha's avatar

Then you need to do what @nakov suggested if you have Valet installed. If not then go step by step. And if you follow documentation or tutorials you are either missing some step or not looking till the end of a video. Cause just installing it isn't enough. You have to tell it which folder to use/monitor.

bugsysha's avatar

I recently got a MacBook and want to use Valet.

Here you said you are having issues installing Valet

I went to the GitHub page of Valet+

but in your SO thread you say Valet+.

What is it out of those two? Majority of users here use https://laravel.com/docs/6.x/valet and maybe you should try it to. Not sure if you are confused by the Valet+ that it is official Laravel product but it is not.

Rainieren's avatar

Read the stackoverflow link I've send. It has a more detailed explanation

Nakov's avatar

@rainieren I see the benefits on using valet-plus, but I also see 85 opened issues and based on the closed rate, approximately once a month an issue is closed. So I would rather use Docker instead if you want those benefits, and for everything else just the Laravel Valet straight from the Laravel documentation. Never had a problem with that package. Even if I did there was always an answer, and the maintainers are much more active to fix any issue.

Just my 2 cents at last :) Don't know if you've followed all the answers from the links I provided above, even the one with:

sudo brew services start dnsmasq

which should most probably fix your no permission issue.

But anyhow, I would not use this package as it seems it is not reliable and not actively maintained.

Rainieren's avatar

I got it working. I can ping now but when I create a site it does not seem to work. I created a site called example and it should return a simple string when I access example.test in chrome. Instead it returns This site is not reachable

Nakov's avatar

@rainieren then we go back again, do you have the valet parked :) or valet links shows the site?

Rainieren's avatar

Yes valet links shows the correct site but in chrome it says the site is not reachable ERR_NAME_NOT_RESOLVED

Nakov's avatar

@rainieren still using valet-plus right? Try running valet fix it might help :)

Other then this, I really don't know anymore. I use valet without the extra package. It works perfectly fine.

CookieMonster's avatar

@nakov I am having this issue too. I added valet park to my project directory and followed the documentation but when I run ping foobar.test, it says unresolved host. My port is showing nginx running. Pls help.

Please or to participate in this conversation.