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

RichardMX's avatar

Help setting up Valet correctly

Hello, i've been spending several hours trying to get Valet working. No luck.

So i followed the instructions:

  1. brew update
  2. brew install php70
  3. brew install mariadb
  4. composer global require laravel/valet
  5. valet install
  6. cd ~/Sites
  7. valet park
  8. laravel new testing-valet

Open browser at testing-valet.dev and nothing. Chrome says "Can't access this website".

So i went to brew services list and i got:

dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist mariadb started ricardo /Volumes/500GBHD/ricardo/Library/LaunchAgents/homebrew.mxcl.mariadb.plist php70 started root /Library/LaunchDaemons/homebrew.mxcl.php70.plist

The which phpoutputs:

/usr/local/bin/php

If i hit php -vi get:

PHP 7.0.6 (cli) (built: Apr 29 2016 04:21:39) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

If i try valet share inside a laravel project i get an address like http://7d3bXXXXX.ngrok.io which displays:

The connection to http://7d3bXXXXX.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address testing-valet.dev:80.

Make sure that a web service is running on testing-valet.dev:80 and that it is a valid address.

The error encountered was: dial tcp: lookup testing-valet.dev: no such host

I don't have apache, nginx, homestead, vagrant or anything blocking/using port 80. I don't have anything weird on /etc/hosts so i don't know what else to do.

I've have the latest Valet 1.1.3 and my composer vendor directory is set up correctly.

Any thoughts or suggestions? Maybe i don't have a service configured correctly? A missing daemon?

Thanks in advance. I'm running OSX El Capitan.

0 likes
23 replies
RichardMX's avatar

Just in case someone has a problem with Valet you can try these suggestions by Adam Wathan (posted on Github):

Most common things to try:

Delete ~/.valet and re-run valet install

Log out of your OSX user account and back in, sometimes this is needed for the DNS resolver changes to get picked up

Look for errors in PHP FPM logs: cat /usr/local/opt/php70/var/log/php-fpm.log

Verify dnsmasq and php70 are running as root in brew services list

Make sure /usr/local/var/log exists so PHP FPM can write logs there

Verify PHP FPM is running by running ps aux | grep php and looking for a couple of FPM instances

Verify User and Group are set to your user name and the staff group in /usr/local/etc/php/7.0/php-fpm.d/www.conf, the installer should do this for you but worth double checking.

nateritter's avatar

Just tried valet share for the first time and I'm getting these dial tcp [...] no such host errors also. I've done all the things @RichardMX suggested to no avail.

Will keep troubleshooting and working to figure it out, but bumping this in case anyone has other suggestions.

vhguillen's avatar

I have the same issue, but caddy don't start on port 80, when I check the port there's no caddy listening, I try everything, delete, remove, reinstall, check my mac, and nothing.. any help?

nateritter's avatar

Did you try the process outlined in the answer to my SO post (linked above)? That process is what I use and it helps every time. More than that, I'm not sure.

nateritter's avatar

Fixed my issue. I'm not sure how I was even able to see domain.localhost but when I pinged it it wouldn't resolve. That reminded me after reinstalling valet I had forgot to valet domain localhost. After running that command, I was ablet o ping domain.localhost again and at that point valet share ngrok domains started working.

vhguillen's avatar

@nateritter #brew services list

Name Status User Plist

dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

mariadb stopped

php70 started root /Library/LaunchDaemons/homebrew.mxcl.php70.plist

I'm getting this in the logs mac console: 7/16/16 7:38:26.969 AM dnsmasq[16244]: failed to create listening socket for 127.0.0.1: Permission denied 7/16/16 7:38:26.969 AM dnsmasq[16244]: FAILED to start up

Thanks in advance

vhguillen's avatar

@nateritter at this point I'm not ablet past this point:

  • You may however need to tap brew/services first

  • brew tap homebrew/services

  • If it's not there, run

  • brew install dnsmasq

  • brew services start dnsmasq

brew install dnsmasq but. I did this and when I re-run brew tap homebrew/services it shows nothing. And still getting the error log, dnsmasp failed to startup.

nateritter's avatar

What is in the last few lines of your /usr/local/etc/dnsmasq.conf file? If it's something like this: conf-file=/Users/YOURUSERNAME/.valet/dnsmasq.conf then what's the contents of that file?

vhguillen's avatar

@nateritter

1 - Yes the last few lines of /usr/local/etc/dnsmasq.conf is

conf-file=/Users/YOURUSERNAME/.valet/dnsmasq.conf

And the content of this file is: address=/.dev/127.0.0.1

nateritter's avatar

Inside the directory /etc/resolver, there should be a file entitled dev with the following contents

nameserver 127.0.0.1

Is that true?

nateritter's avatar

Hmm.. well, I guess it's out of my league. Sorry. Wish I could help more.

vhguillen's avatar

Jeje, don't worry @nateritter your help were very welcome, I'm just keep searching and testing, I ran dnsmasq with root and eliminate the socket permission console error. But valet still don't work, If I find the solution I'll let you know.

vhguillen's avatar

@nateritter : I found something it is with caddy, I ran this command inside the project folder.

In this case ~/Sites/blog/

sudo ~/.composer/vendor/laravel/valet/bin/caddy --conf=/Users/{myuser}/.valet/Caddyfile

and it works.

Other wise it doesn't work.

vhguillen's avatar

I found the solution @nateritter, it was a mcafee antivirus installed, was blocking the LaunchDaemon service.

Now I have valet working perfectly.

Thanks for all the help.

nateritter's avatar

Ah, I never would have guessed that one. :) Congrats on figuring it out!

Cheers.

psutinrerk's avatar

I have the same problem :(

I don't have mcafee installed how can I test if my LaunchDaemon service is blocked?

Here is my system info

Mac osx Siera 10.12.4 (16E195) Laravel Valet 2.0.4 PHP 7.1 dnsmasq-2.76

Tried everything with no success, Could you please help

Please or to participate in this conversation.