Fixing Laravel Valet on macOS Sierra
I'm one of those people who runs beta software. A short time after the keynote is finished I'll update (or wreck) my phone with the beta version of iOS. My Mac generally gets the beta treatment not much later. Of course there are some risks involved. There's no guarantee that your applications will still work. Though your mileage may vary, it's my experience however that those betas are pretty stable.
With macOS Sierra there was one piece of software that didn't work properly: Laravel Valet. For some obscure reason Valet just stopped working after a couple minutes. The requests just hang. After some time an ERR_CONNECTION_REFUSED
was displayed in Chrome. After running valet restart
it ran fine for some more minutes. After poking around in the configuration of caddy, the webserver that powers Valet, and the php.ini
file I found no solution. A complete reinstall of Laravel Valet did not solve the issue. I learned to live with the problem, regularly running valet restart
. I even set up an alias for it.
But luckily Bryce Adams found the solution (Martin Bastien notified me about it). It's very simple: you just have to update the caddy server to the latest version manually. Here are the steps involved:
- Download `caddy_darwin_amd64.zip` from Caddy's releases page on GitHub.
- Extract the files and rename the main executable `caddy_darwin_amd64.zip` to `caddy`
- Copy it over and replace the old `caddy` file in this directory: `~/.composer/vendor/laravel/valet/bin/`
- Run `valet restart`
- Profit!
I hope this post can help all the crazy ones running beta software.
EDIT on 2016-09-21: alternatively, you could use the dev-sierra
branch to get a working version of Valet on macOS Sierra.
@freekmurze Can also use the `dev-sierra` branch which has Caddy 0.9.1 baked in ??
— Adam Wathan (@adamwathan) September 21, 2016
EDIT on 2016-09-24: Adam has published a list of common problems and solutions for running Valet on Sierra.
What are your thoughts on "Fixing Laravel Valet on macOS Sierra"?