Valet Plus
Blazing fast macOS PHP development environment

On this page
I first heard about Valet Plus a while ago and have to admit I did not pay much attention.
When you work in an agency every minute counts, and if your local environment does not work and you have to spend time fixing it, you are dead.
If you come from an environment like Vagrant
or Docker
it is easier
because everything is installed in a box or a container, so you are free to play installing things in your laptop and if they
don’t work, and you need to carry on working you can do vagrant up and continue the experiment in another time.
Unfortunately that was not my case because, yes I use Vagrant
for some of my projects but for the
majority of them I use my local dev environment
, in other words, Apache, MySql, Redis, etc.
Everything Installed directly in macOS.
This can cause some problems, and when I first tried to install it I did not succeed, so I ended up going back to my old setup.
Recently I decided to give it another chance. The following instructions summarise what I did to finally get it working.
First I uninstalled/deleted all the apps files related:
brew uninstall --force php56 php56-apcu php56-opcache php56-xdebug php56-yaml
brew uninstall --force php70 php70-apcu php70-opcache php70-xdebug php70-yaml
brew uninstall --force php71 php71-apcu php71-opcache php71-xdebug php71-yaml
brew uninstall --force php72 php72-apcu php72-opcache php72-xdebug php72-yaml
brew uninstall --force httpd
brew uninstall --force blackfire-php71
brew uninstall --force php
brew uninstall --force php@5.6
brew uninstall --force php@7.0
brew uninstall --force php@7.1
brew uninstall --force php@7.2
brew uninstall --force php@7.3
brew unlink valet-php@5.6 && brew uninstall valet-php@5.6
brew unlink valet-php@7.0 && brew uninstall valet-php@7.0
brew unlink valet-php@7.1 && brew uninstall valet-php@7.1
brew unlink valet-php@7.2 && brew uninstall valet-php@7.2
brew unlink php71 && brew uninstall php71 && brew uninstall --ignore-dependencies php71
rm -rf /usr/local/opt/valet-php@*
rm -rf /usr/local/opt/php*
rm -rf /usr/local/etc/valet-php/*
brew upgrade
brew update
brew cleanup
brew doctorbrew doctor.Then follow the instructions to install Valet Plus and make sure it installs with no errors.
First Issue
When I tried to browse a site I got an error saying something like:
value of `$valetConfig['paths']` in `/Users/rdiaz/.composer/vendor/weprovide/valet-plus/server.php:55` was not an array…After debugging, I discovered that Valet tries to get config.json from $home/.valet/config.json but for some reason Valet created and filled the .valet/ directory inside /var/root/
I did not install Valet using sudo and my $home directory was writable… so I don’t know why it does this.
The Fix
I fixed the issue, creating a symlink from var/root/.valet to $home/.valet/
Second Issue
When running valet fix I got:
No releases available for package “pecl.php.net/apcu_bc”
install failedIn my case there was a problem with openssl.
pecl tries to connect to pecl.php.net/apcu_bc but it seems the http version is no longer available. Then it tries to connect using https, but for that it needs openssl.
The Fix
I fixed the issue by reinstalling openssl:
brew reinstall opensslAlthough it is already mentioned in the Valet installation instructions
, I think it is worth mentioning it again. You need to make sure nothing is listening on port 80.
For that you can use
sudo lsof -n -i -P | grep -i ":80 (LISTEN)"$ sudo lsof -n -i -P | grep -i ":80 (LISTEN)"
nginx 34924 root 9u IPv4 0xba753e697516dde7 0t0 TCP *:80 (LISTEN)
nginx 34933 john 9u IPv4 0xba753e697516dde7 0t0 TCP *:80 (LISTEN)
nginx 34934 john 9u IPv4 0xba753e697516dde7 0t0 TCP *:80 (LISTEN)
nginx 34935 john 9u IPv4 0xba753e697516dde7 0t0 TCP *:80 (LISTEN)
nginx 34936 john 9u IPv4 0xba753e697516dde7 0t0 TCP *:80 (LISTEN)and if that shows something, just kill the processes as usual or use top / htop to kill the processes.
Third Issue
When running valet fix I got:
Error: Calling needs :cxx11 is disabled! There is no replacement.After debugging and searching on the Internet about it, I discovered that this was an actual issue in the php repository used by Valet.
The Fix
This one is quite easy. Just go to the homebrew-php directory:
cd /usr/local/Homebrew/Library/Taps/henkrehorst/homebrew-php/FormulaAnd get the latest changes in master branch:
git fetch origin
git rebase origin/master