Installing Craft CMS, Statamic and Perch Runway on Laravel Valet

Scott Gruber
Feb 20, 2019 · 11 min read
Image for post
Image for post

Canonical version on my personal website

A long time ago one of my favorite things to do on the web was to explore content management systems. It still is.


Around 1999, I used to visit my friend and play around on PC computers. We’d install scripts like Francisco Burzi’s phpnuke just for the fun of it. View source and installing programs was how I learned to build websites. The web in those day was an exciting time. Today is no different. Twenty years later, I’m still excited about the web. Tonight let’s setup a new development environment and try out a few modern content management systems.

Today, alternatives to Drupal and WordPress have never looked better. To escape the orbit of WordPress and its tangled web of backwards compatible code. To keep structured content and avoid Drupal complexity. It is possible. Of course there is beauty and utility in the big planets. Each has its place and purpose. Yet life and real innovation is happening on smaller worlds. These alternative tools help writers create rich media experiences and inform the UI designs in more popular tools. Drupal Gutenberg and WordPress Gutenberg give editors new tools to share stories. Yet, so far Gutenberg has fallen short on accessibility and structured content. It is worth while to demo the competition and check out the alternatives. Plus for me it’s fun to tinker and play.

Note: At 2018 WordCamp LAX and Roy Sivan showed Gutenberg Object Plugin an innovative solution to save Gutenberg data as clean array. I posted my notes and installed it on

Roy describes the project:

the new systems show the viable ways to separate content from presentation and help developers. So much to explore. If only we could escape the pull of the big giants.

Image for post
Image for post


Content Management Systems and Laravel Valet Links


Although this isn’t rocket science, some tools will help.

We’ll use brew to install PHP, MySQL and composer to install Craft and Statamic. If you need to get that setup first please go here, here and here

Back yet? OK. Super. Let‘s takeoff.

Image for post
Image for post

Install PHP

Pretty easy to install PHP. I only needed to run this command:

brew install php

brew services start php

That was easy. To test, run command php -v Hmm. PHP 7.1.9. What happened? I thought brew installed 7.3 the latest version. Oh yea, I remember. macOS Mojave includes PHP 7.19. I could use that, but since this is an experiment I figure what the hell. Lets try the latest version of PHP circa February 2019. What could go wrong?

To point to PHP 7.3 I added PATH=/usr/local/Cellar/php/7.3.2/bin:$PATH to my bash .profile file.

Boot up nano, my terminal text editor of choice, open the file nano ~/.profile and paste in the path and save. To activate, restart iTerm or reload your bash file by entering source ~/.profile from the command line and hit return.

Now when I ran php -v the results were PHP 7.3.2

Moving in the right direction. Next step was to install MySQL.

Image for post
Image for post

Install MySQL

Once more, we turn to brew to install MySQL. Here’s those command.

brew install mysql

And wait while brew does its magic.

brew services start mysql

And after a few nanoseconds, I saw this:

We've installed your MySQL database without a root password. To secure it run:

MySQL is configured to only allow connections from localhost by default

To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Summary
/usr/local/Cellar/mysql/8.0.15: 267 files, 234.6MB

Please do change your the root user’s password.

MySQL version 8 almost caused a big crash and burn. Apparently, it has a new authentication plugin for database connections that isn’t widely supported yet. Stack Overflow to the rescue. Although I found many posts Alexander Diachenko explained what was going on and offered a solution.

The error happened because MySQL 8.0.4 changed its default authentication mechanism from mysql_native_password to caching_sha2_password. One of the ways to fix the issue is to run mysqld with additional option:

mysqld --default-authentication-plugin=mysql_native_password

In short, for now MySQL 8 isn’t really usable out of the box with most existing client implementations.

Bit of a drag but not a deal breaker. I needed to up find my.cnf file. How to do that? With a little grep magic on the command line. Thanks to a Carpentries Unix Shell workshop I could use a little grep magic. The Carpentries teach foundational coding and data science skills to researchers worldwide. A fantastic group offering free lessons on python, Git, R programming to increase digital literacy among researchers.

mysql --help | grep cnf

which resulted in:

order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

This version /usr/local/etc/my.cnf is the one we’re looking for since it had this text.

Default Homebrew MySQL server config

So I opened it with nano.

nano /usr/local/etc/my.cnf

and pasted the following line to load the older plugin.


and restarted mysql

brew services restart mysql

Last fix was to alter a couple of users I already had created in MySQL so they would use the older authentication protocol.

ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';


OK. That was kind of scary, but made it. You may decide to not go with bleeding edge versions of PHP and MySQL and that’s ok but I learned some new tricks. Onward.

Image for post
Image for post

Install Laravel Valet

For almost five years I’ve been using MAMP Pro to run my local server. I’m comfortable with it, but for the sake of exploration, and to make things more difficult I decided to install laravel valet. Once I got it running I see why its so popular. One benefit is I can run multiple hosts concurrently.

Of course Laravel Valet is optional and Craft, Statamic and Perch Runway can run with MAMP. Skip this section if you don’t want to venture into Laravel land, but since Statamic recommends running it, and you’ve made it this far already I think you’re an adventurous developer type so why not?

Back to the terminal and run the following command composer global require laravel/valet . After it finishes downloading run valet install command. This will configure and install Valet and DnsMasq, and register Valet’s daemon to launch when your system starts.

There is no need to run valet start or valet install ever again once the initial Valet installation is complete. Although knowing some of these commands will help.

  • valet start
  • valet stop
  • valet restart
  • valet link - used to serve a single site in a directory and not the entire directory. I prefer park
  • valet park - any project you create in your parked directory will be served with the http://folder-name.test convention.

I want to run more than one host on my computer so I’ll need to use valet park.

Create a new directory on your Mac by running mkdir ~/Sites or if you already have it just cd ~/Sites and run valet park. This command will register your current working directory as a path that Valet should search for sites.

That’s all there is to it.

Now, any Laravel project I create within my “parked” directory will automatically be served using the http://folder-name.test convention. Cool!

Secure Sites

By default, Valet serves sites over plain HTTP. However, if you would like to serve a site over encrypted TLS using HTTP/2, use the secure command.

For example, if your site is being served by Valet on the craftcms-site.test domain, you should run the following command to secure it:

valet secure craftcms-site which creates configuration files.


To “unsecure” a site and revert back to serving its traffic over plain HTTP, use the unsecure command like so.

valet unsecure craftcms-site

valet unsecure statamic.test

Image for post
Image for post

Installing Craft 3

Installation Instructions | Craft 3 Documentation and a very helpful article by Jalen Davenport.

composer create-project craftcms/craft ~/Sites/craftcms-site
Installing craftcms/craft (1.0.39)

Bunch of stuff downloads, while I went to sleep.

After waking up, feeding Ms. Fuzzy B Kitty and making myself a cup of fresh coffee I woke up the computer from its slumber, opened iTerm and saw:

______ .______          ___       _______ .___________.
/ || _ \ / \ | ____|| |
| ,----'| |_) | / ^ \ | |__ `---| |----`
| | | / / /_\ \ | __| | |
| `----.| |\ \----./ _____ \ | | | |
\______|| _| `._____/__/ \__\ |__| |__|

______ .___ ___. _______.
/ || \/ | / |
| ,----'| \ / | | (----`
| | | |\/| | \ \
| `----.| | | | .----) |
\______||__| |__| |_______/

Generating a security key ... done (**************************)

Welcome to Craft CMS! Run the following command if you want to setup Craft from your terminal:

~/Sites/craftcms/craft setup

Looking good. Now run the command craft setup

$ Which database driver are you using? [mysql,pgsql,?]:

and had to make a choice: use MySQL or PostgresSQL.

I haven’t used Postgres before so I’ll save that for another day. At the moment, I have enough to learn with Craft, Twig, Laravel Valet (might as well see what that’s about and not use MAMP.) and keeping some time left over for my mental and physical health. Plus after that trouble with the caching_sha2_password MySQL 8.0 I wasn’t going to play around with fire twice.

So, MySQL it is.

I created a database, created a user with the privileges Check on Craft site for user permissions to set.

I ran the setup wizard, created a user and logged into my first Craft CMS site over with SSL using Laravel Valet at https://craftcms-site.test

Woo hoo!

Welcome to Craft CMS

OK then! Next up is Statamic. With no database it should be easier right?

Image for post
Image for post

Installing Statamic

composer global require statamic/cli

And got this result.

$ Using version ^1.0 for statamic/cli
$ ./composer.json has been updated
$ Loading composer repositories with package information
$ Updating dependencies (including require-dev)
$ Your requirements could not be resolved to an installable set of packages.
$ friendsofphp/php-cs-fixer v2.4.0 requires php ^5.6 || >=7.0 <7.2 -> your PHP version (7.3.2) does not satisfy that requirement.
$ Installation failed, reverting ./composer.json to its original content.

Oh well. Looks like I’ll need to wait to use composer to install Statamic until php-cs-fixer supports PHP 7.3. (Note php-cs-fixer v.2.4.1 does support PHP 7.3, but the brew repository hasn’t updated it at the time of this writing.

Guess this is what happens when living on the edge. I’m still happy. I’ve got Laravel Valet installed and can run Craft CMS over https. I’ll explore it first, and then try out Statamic in the near future.

Wait. Wait. Hold your horses. I got an idea.

Instead of using composer how about if I just download the zip file and follow the instructions on the Statamic site.

  • Download the latest version of Statamic. Like Craft and Perch it is free for local development.
  • Unzip files into your root folder
  • Run the Trailhead Installer. Statamic has a little tool that will check your environment for all the necessary requirements, file permissions, locales, and help you get your first User created.
  • head to~/Sites/statamic-site/installer.php follow the instructions and after that’s done delete installer.php

Run valet secure statamic-site and login to the Control Panel at https://yoursite.test/cp and voilà now we have Statamic running over SSL.

Now both Craft and Statamic are installed.

What’s next? How about installing my favorite CMS Perch Runway!

Image for post
Image for post

Installing Perch Runway

I downloaded a free trial version of Perch Runway to run locally and copied it to my ~/Sites folder. Remember I have Laravel Valet parked looking for any sites with a .test domain so the server is ready to go.

I created a MySQL database, created a user and opened my browser to http://perchrunway.test/perch/setup. 404 error. No joy.

Out of the box, Laravel Valet supports for Craft, WordPress, Statamic and many others, including Drupal and WordPress, but it does require a custom driver for Perch Runway.

Fortunately, the Perch community is generous (like so many communities on the web) and Ryan Gittings, a percher from the UK posted a custom driver he wrote. In the perch community, developers are called perchers and we like to perchify a site. I owe him a beer, coffee or some kind of tip. Follow him on twitter. Or join the Perchology slack community.

Ryan’s instructions to install was straightforward. Copy his custom drive to Valet’s drivers folder here /Users/{your_username}/.valet/Drivers.

Note: I compared Ryan’s custom driver to the SampleValetDriver.php provided by Laravel and decided to put back the isStaticFile function in case I need to run plain html static files. I forked his repo to my GitHub account.

In the Drivers folder I now have two files it looks something like this:

$ ~/.config/valet/Drivers 
$ PerchRunwayValetDriver.php
$ SampleValetDriver.php

I ran the Perch Runway setup script http://perchrunway.test/perch/setup, created a new user, logged in and was in. To add SSL, don’t forget to run valet secure perchrunway in the site’s root folder.

To finish delete the setup folder. Perch will show a message on your diagnostics, and that’s about it.

Here is what it looks like from the command line for all three sites

» ls -la
Image for post
Image for post

Next step

Now that I’ve got Craft, Statamic and Perch Runway served locally on Laravel my first thought would be do a compare and contrast and share what I learn about each cms. Including WordPress and SquareSpace I’ll have a roundup of best tools to take your site to the future and beyond.

Thank you for reading. If this setup doesn’t work on your mac or you have any comments reach me on Twitter.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store