Back to posts
2 min read

How to install valet plus on M1 Mac

Installing valet plus on M1 Mac step by step

How to install valet plus on M1 Mac

Introduction

Valet+ is a development environment for macOS. No Vagrant, no Docker, no /etc/hosts file. https://github.com/weprovide/valet-plus


Valet vs. Valet+

Valet+ is a third-party fork of Laravel Valet. Valet+ adds functionality to Valet with a goal of making things even simpler and faster. We are very grateful to the Laravel team for providing the base that we built Valet+ on. Since this is a fork we'll pull in changes from the original Valet regularly as they are released. Some of the documentation in this readme was taken from the Valet website and provided here for convenience, so that you can read this document and know about all features provided. The original documentation can be found here: https://laravel.com/docs/valet.


Why Valet/Valet+?

Valet+ configures your Mac to always run Nginx in the background when your machine starts. Then, using DnsMasq, Valet+ proxies all requests on the *.test domain to point to sites installed on your local machine. In other words, a blazing fast development environment. Valet+ provides a great alternative if you want flexible basics or prefer extreme speed.


Differences from Valet

Here are a few key differences compared to the original Valet:

  • PHP version switch
  • Xdebug (on/off mode)
  • PHP extensions (mcrypt, intl, opcache)
  • Optimized PHP configuration using opcache
  • MySQL (with optimized configuration)
  • Elasticsearch (optional)
  • Redis
  • Many more features ...


Installing on M1 Mac

- Install Homebrew
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew update && brew upgrade
- Install composer
$ brew install composer
- Install Nginx
$ brew install nginx
$ sudo nginx
- Install valet-php 8.0
$ brew tap henkrehorst/php
$ brew install valet-php@8.0

$ brew link --force valet-php@8.0

- Install valet-plus
$ composer global require weprovide/valet-plus
$ valet fix
$ valet install
- GEOIP and PCRE2

If you get any geoip or pcre2 error, please do the following steps else you can skip these steps.

$ brew install pcre2
$ ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/Cellar/valet-php@8.0/8.0.17/include/php/ext/pcre/pcre2.h

export LDFLAGS="-L/opt/homebrew/opt/pcre2/lib"
export CPPFLAGS="-I/opt/homebrew/opt/pcre2/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/pcre2/lib/pkgconfig"

$ valet fix && valet install

Ref :

Thanks for reading! If you've any errors on installing valet-plus, feel free to contact me at m.me/u.alto.