Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rajibbinalam/a23bac2391f74b7a13892daf01ad84b3 to your computer and use it in GitHub Desktop.
Save rajibbinalam/a23bac2391f74b7a13892daf01ad84b3 to your computer and use it in GitHub Desktop.
Install Laravel Valet and mysql on macOS

Laravel Valet Setup (Mac)

This will get you setup with Laravel & Valet on your Mac. Quentin Watt has a good video tutorial on getting setup here as well

Install Homebrew

Go to https://brew.sh/ and copy the command and run in your terminal

It will be something like this...

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

Then update

brew update

Install PHP

brew install php

Install composer (PHP Dependency Manager)

brew install composer

Put Composer in your $PATH

Run the following and see if it says "composer" anywhere

echo $PATH

If not, you have to add it to your path

Open your .zshrc (This command will open it with VS Code but you can open with any text editor)

code ~/.zshrc

Add this line and save

export PATH=$PATH:$HOME/.composer/vendor/bin
  • NOTE: If you are using bash instead of zsh, you need to edit ~/bashrc instead of ~/zshrc

  • Restart your terminal and run this again and you should see "composer"

echo $PATH

Install Valet with Composer

composer global require laravel/valet

Run valet install

valet install

(Optional) Install Laravel Installer

composer global require laravel/installer

Tell Valet to use the current folder for Laravel projects

cd path/to/park/valet #cd ~/Sites ##main is: cd /, cd Volumes/Disk\ E/Sites/
valet park

Open your project

Go to your browser and type http://PROJECT_FOLDER.test

To see all parked projects

valet parked

To rename your TLD from .test to something else, such as .dev

valet tld dev

Install MySQL #Latest Version

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment