Skip to content

Instantly share code, notes, and snippets.

@rajibbinalam
Last active September 21, 2024 17:39
Show Gist options
  • Save rajibbinalam/418b7203489e53dcfada197f0fcef208 to your computer and use it in GitHub Desktop.
Save rajibbinalam/418b7203489e53dcfada197f0fcef208 to your computer and use it in GitHub Desktop.
Install PHP, MySQL, nginx and Valet on macOS

Install HomeBrew if Needed

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Install PHP

brew install php

Install Composer

brew install composer

Install MySQL

brew install mysql

Note: macOS 12 is not support latest version of mysql. install mysql 8.0

brew install [email protected]
brew --prefix [email protected] #it'll return => /usr/local/opt/[email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Continue as others...

Start Brew Service

brew services start php
brew services start mysql

Secure your MySQL installation, setup a root password by running:

mysql_secure_installation           #sudo mysql_secure_installation
brew services restart mysql

# Run MySQL
mysql -u root -p

Install phpmyadmin

brew install phpmyadmin

Brew Services

brew services list

Install Valet & Park

composer global require laravel/valet
valet install

cd ~/Sites
valet park

Serve a specific project no matter where it is

valet link /path/to/project

Serve a project over HTTPS with TLS

valet secure /path/to/project
valet unsecure /path/to/project

==========> Switch PHP Version:s <=============

valet use [email protected]

brew unlink php
brew link --overwrite --force [email protected]

valet uninstall
composer global remove laravel/valet
brew uninstall --force [email protected]
brew uninstall --force php nginx dnsmasq
brew upgrade
brew install php
composer global require laravel/valet
valet install
brew upgrade
brew cleanup
valet restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment