DEV Community

Cover image for How to uninstall and completely remove Valet+?
Rafael Corrêa Gomes
Rafael Corrêa Gomes

Posted on • Updated on • Originally published at rafaelcg.com

How to uninstall and completely remove Valet+?

I began to use Valet Plus when I switch my MacBook and I had to avoid using Docker during the Magento 2 development, I didn't know in the beginning that Valet Plus is a fork of Valet from Laravel and that the main differences are between them, so I added them in this article to let you know too.

Since one and a half year I switched again to a better Macbook Pro which allowed me to return to Docker with no problems, then I decided to keep my Valet Plus installation just to have the basic commands locally, for example, composer, CLIs from Magento Cloud, Platform.sh and others. Even though we all know that Valet Plus brings a lot of issues because of its instability, and most of the time a definitive fix might be achieved by executing a complete removal of it and reinstall it.

Remove Valet+

To remove it completely I use a gist that contains all the required commands, you can run it directly via this command below.

bash <(curl -s https://gist.githubusercontent.com/dannygsmith/5b74ba708d7bf8621c1cb6b959ece99f/raw/f1b0e88ba4e0a753b112bd2187c22bf8eaa9a234/valet-plus-destroy)
Enter fullscreen mode Exit fullscreen mode

You will see this screen below at the finish.

How to uninstall and completely remove Valet Plus

What does it run?

The raw script is this one below in case you want to run command by command.

#!/usr/bin/env bash

#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
VP_BOLD='\033[1m'
VP_UNDERLINE='\033[4m'

# clear the screen
clear

# cache sudo password so it will only need to be entered once.
echo -e "${VP_RED}${VP_BOLD}You may be asked to enter your password twice….${VP_NONE}"
sudo -v

# update homebrew
brew update

# upgrade homebrew formulas
brew upgrade

# cleanup mess
brew doctor
brew cleanup
brew prune

# stop Valet
#==================
valet stop
sudo valet stop
composer global remove laravel/valet
composer global remove weprovide/valet-plus
brew services stop  --all

# Uninstall dnsmasq
#==================
sudo launchctl unload homebrew.mxcl.dnsmasq.plist
brew uninstall dnsmasq
sudo rm -rf /usr/local/etc/dnsmasq.conf
sudo rm -rf /usr/local/Cellar/dnsmasq
sudo rm -rf /usr/local/opt/dnsmasq
sudo rm -rf /etc/resolver
sudo rm /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo killall dnsmasq

# Uninstall nginx
#================
sudo launchctl unload homebrew.mxcl.nginx.plist
brew uninstall nginx
sudo rm -rf /usr/local/etc/nginx/
sudo rm -rf /usr/local/Cellar/nginx
sudo rm -rf /usr/local/opt/nginx
sudo rm /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
sudo killall nginx
killall nginx

# Uninstall PHP72
#================
sudo launchctl unload homebrew.mxcl.php72.plist
brew uninstall php72 php72-mcrypt php72-xdebug php72-opcache php72-apcu php72-geoip php72-intl php72-opcache n98-magerun n98-magerun2
sudo rm -rf /usr/local/etc/php
sudo rm -rf /usr/local/Cellar/php72*
sudo rm -rf /usr/local/opt/php72*
sudo rm -rf /usr/local/opt/php72
sudo rm -rf /usr/local/sbin/php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php72.plist
sudo killall php-fpm

# Uninstall PHP71
#================
sudo launchctl unload homebrew.mxcl.php71.plist
brew uninstall php71 php71-mcrypt php71-xdebug php71-opcache php71-apcu php71-geoip php71-intl php71-opcache n98-magerun n98-magerun2
sudo rm -rf /usr/local/etc/php
sudo rm -rf /usr/local/Cellar/php71*
sudo rm -rf /usr/local/opt/php71*
sudo rm -rf /usr/local/opt/php71
sudo rm -rf /usr/local/sbin/php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php71.plist
sudo killall php-fpm

# Uninstall PHP70
#================
sudo launchctl unload homebrew.mxcl.php70.plist
brew uninstall php70 php70-mcrypt php70-xdebug php70-opcache php70-apcu php70-geoip php70-intl php70-opcache n98-magerun n98-magerun2
sudo rm -rf /usr/local/etc/php
sudo rm -rf /usr/local/Cellar/php70*
sudo rm -rf /usr/local/opt/php70*
sudo rm -rf /usr/local/opt/php70
sudo rm -rf /usr/local/sbin/php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php70.plist
sudo killall php-fpm

# Uninstall PHP56
#================
sudo launchctl unload homebrew.mxcl.php56.plist
brew uninstall php56 php56-mcrypt php56-xdebug php56-opcache php56-apcu php56-geoip php56-intl php56-opcache n98-magerun n98-magerun2
sudo rm -rf /usr/local/etc/php
sudo rm -rf /usr/local/Cellar/php56*
sudo rm -rf /usr/local/opt/php56*
sudo rm -rf /usr/local/opt/php56
sudo rm -rf /usr/local/sbin/php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php56.plist
sudo killall php-fpm

# Uninstall Mysql
#================
brew uninstall mysql
brew cleanup
sudo rm /usr/local/my.cnf
sudo rm /usr/local/etc/my.cnf
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /usr/local/Cellar/mysql
sudo rm -rf /usr/local/var/mysql

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
sudo killall mysqld

# Uninstall Valet
#================
brew uninstall mailhog
brew uninstall redis
sudo launchctl unload homebrew.mxcl.mailhog.plist
sudo launchctl unload homebrew.mxcl.redis.plist
sudo rm /Library/LaunchDaemons/homebrew.mxcl.*
sudo killall mailhog
sudo killall redis

sudo rm -rf ~/.valet
sudo rm -rf ~/.composer/vendor/weprovide/
brew services stop  --all

# remove composer from path
before='export PATH="$PATH:$HOME/.composer/vendor/bin"'
after=''
sed -i  "s#${before}##g" ~/.bash_profile

# update homebrew
brew update
# upgrade homebrew formulas
brew upgrade
# cleanup mess
brew doctor
brew cleanup
brew prune

echo " "
echo -e "${VP_GREEN}${VP_BOLD}user brew services list to see if any services are running${VP_NONE}"
brew services list

echo " "
echo -e "${VP_GREEN}${VP_BOLD}use ps to see if any process's are running${VP_NONE}"
ps  aux | grep DesktopServer.app       | grep -v grep| head -1
ps  aux | grep "Local by Flywheel.app" | grep -v grep| head -1
ps  aux | grep -i "xamp"               | grep -v grep| head -1
ps  aux | grep -i "mamp"               | grep -v grep| head -1
ps  aux | grep dnsmasq                 | grep -v grep| head -1
ps  aux | grep nginx                   | grep -v grep| head -1
ps  aux | grep php                     | grep -v grep| head -1
ps  aux | grep mysql                   | grep -v grep| head -1

echo -e "${VP_RED}${VP_BOLD}REBOOT NOW BEFORE YOU RUN THE INSTALL${VP_NONE}"
Enter fullscreen mode Exit fullscreen mode

Valet vs. Valet+

Valet+ is a third-party fork of Laravel Valet. Valet+ adds functionality to Valet with the 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: laravel.com/docs/valet.

Since Valet+ is intended to replace Valet, it still uses the same valet command-line name. Any changes in its interface are documented below.

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)
  • Redis
  • Elasticsearch (optional)

Top comments (2)

Collapse
 
leslieeeee profile image
Leslie

If you are a macOS user, ServBay.dev is worth to try. You don't need to spend some time or couple of days to setup anything. Just download it and you can use it immediately. You can run multiple PHP versions simultaneously and switch between them effortlessly.
More important, you can uninstall it with one click, so it won't be any remnants of the software left on your computer.
Honestly, this tool has greatly simplified my PHP development and is definitely worth trying!

Collapse
 
tope67059814 profile image
tope

hey