Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Troubleshooting Laravel Valet on macOS Sierra

Published on by

Troubleshooting Laravel Valet on macOS Sierra image

macOS Sierra was released just a few days ago and everybody is starting to upgrade. Some users of Laravel Valet have reported some problems and Adam Wathan has put together a list of common problems and troubleshooting tips to help resolve issues he’s been seeing.

With his permission to post here is a list of things to look for:

All I see is “It works!”

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart

Valet randomly dies

You are probably still on Valet <= 1.1.19, it’s recommended to pin to ^1.1.22.

First, edit ~/.composer/composer.json to point to ^1.1.22 like this:

```diff
- "laravel/valet": "^1.1.19",
+ "laravel/valet": "^1.1.22",
 
Next, run `composer global update` and then restart Valet with it’s `valet restart` command.
 
Every time I refresh I see a totally random file!
-------------------------------------------------
 
You are running Caddy 0.9.2, which has a known bug related to fastcgi connections.
 
Edit your `~/.composer/composer.json` to point to `^1.1.22` like this:
- "laravel/valet": "^1.1.19",
+ "laravel/valet": "^1.1.22",
 
Next, run `composer global update`, ensure you are now running Caddy 0.9.1 by running `~/.composer/vendor/laravel/valet/bin/caddy -version` and finally restart Valet `valet restart`
 
I’m getting a 502 Bad Gateway error.
------------------------------------
 
Usually, this means something is messed up with PHP FPM. The first step is to confirm that FPM is *not* running:

ps aux | grep fpm

 
You should see at least two processes there if PHP FPM is running (one is grep, ignore that one.) Chances are PHP FPM *is not* running.
 
Next, check the PHP FPM error log to find out why it’s not running:

cat /usr/local/opt/php70/var/log/php-fpm.log

 
Try to resolve any errors you see. Here’s a few common ones:
 
- `/var/run/valet/fpm.socket` does not exist
- Failed to open configuration file `/usr/local/etc/php/7.0/php-fpm.conf`
 
Problem: /var/run/valet/fpm.socket does not exist!
--------------------------------------------------
 
If you see an error similar to:
 
> Unable to bind listening socket for address ‘/var/run/valet/fpm.socket’: No such file or directory
 
in the file `/usr/local/opt/php70/var/log/php-fpm.log`, you were probably running `dev-master` and have now switched back to tagged releases.
 
Valet 1.1.22 attempts to automate fixing this issue by explicitly configuring where PHP FPM should listen.
 
First make sure `~/.composer/composer.json` points to `^1.1.22`:
  • "laravel/valet": "^1.1.19",
  • "laravel/valet": "^1.1.22",
 
Then run `composer global update` and finally `valet install`.
 
Problem: php-fpm.conf is missing!
---------------------------------
 
Something went wrong when installing PHP through Homebrew. This seems to happen on fresh non-upgrade installations of macOS Sierra.
 
1. Uninstall PHP 7: `brew uninstall php70`
2. Reinstall PHP 7 from source: `brew install php70 --build-from-source`
3. Re-run `valet install`
 
Where to Look for Valet Errors?
-------------------------------
 
If you are still running into problems, here’s a list of log files to check:
 
**Caddy start log:**

/tmp/com.laravel.valetServer.err

 
**PHP FPM error log:**

/usr/local/opt/php70/var/log/php-fpm.log

 
**Caddy error log:**

~/.valet/Log/error.log

 
Hopefully with this guide you will be able to pinpoint any errors you have and can fix them through either Brew or Composer.
Eric L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Battle Ready Laravel

The ultimate guide to auditing, testing, fixing and improving your Laravel applications so you can build better apps faster and with more confidence.

Visit Battle Ready Laravel
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
NativePHP logo

NativePHP

Build rich mobile apps across iOS and Android from a single Laravel codebase. This changes everything!

NativePHP
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Join the Mastering Laravel community logo

Join the Mastering Laravel community

Connect with experienced developers in a friendly, noise-free environment. Get insights, share ideas, and find support for your coding challenges. Join us today and elevate your Laravel skills!

Join the Mastering Laravel community
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
Manage Taxonomies, Categories, and Tags in Laravel image

Manage Taxonomies, Categories, and Tags in Laravel

Read article
Extract Arrays from Any Data Type with Laravel's Arr::from Method image

Extract Arrays from Any Data Type with Laravel's Arr::from Method

Read article
Better defaults for your Laravel applications with Essentials image

Better defaults for your Laravel applications with Essentials

Read article
Repeat Strings Efficiently with Laravel's Str::repeat Method image

Repeat Strings Efficiently with Laravel's Str::repeat Method

Read article
Encrypt and Decrypt String Helpers in Laravel 12.18 image

Encrypt and Decrypt String Helpers in Laravel 12.18

Read article
Keep Your Place: Enhancing User Experience with Fragment Method image

Keep Your Place: Enhancing User Experience with Fragment Method

Read article