The Two Percent

Hire Me

Fixing Statamic permissions on Mac

I’ve been messing around with Statamic quite a bit recently. I’m currently running it via the Lando local environment. I’ve run in to a few issues when using it, seeing errors like:

Call to a member function selectedQueryColumns() on null
statamic file_put_contents failed to open stream: No such file or directory
file_put_contents(/app/storage/framework/cache/facade-dd4ce9942f0fa07b748ce199a2359baac8355953.php): failed to open stream: No such file or directory

These error messages are pretty crappy, and don’t allude much to what is happening. After some sleuthing and working out, it seemed that it was all down to permissions.

In your project directory, run the following lines at the command line:

# this makes you owner of storage directory
sudo chown -R $USER:www storage 

# this makes you owner of cache directory
sudo chown -R $USER:www bootstrap/cache 

# this sets write permissions
chmod -R 775 storage 
chmod -R 775 bootstrap/cache

If that still doesn’t work, try clearing cache:

php artisan route:clear && php artisan config:clear && php artisan cache:clear