How to Set Up Laravel Valet on Mac and Serve Sites

Last Updated on by in Laravel

This is a step by step tutorial on Laravel Valet. In this Laravel 9 tutorial, we are going to learn how to set up or configure a Laravel development environment on the Mac and how to run laravel web applications through Laravel Valet mechanism.

Installing Homebrew in Mac

This tutorial requires the Homebrew package manager installed on your development machine. You can execute the following command from your terminal window:

If you have already installed Homebrew package manager, then skip this step and jump on to the other step.

/bin/bash -c "$(curl -fsSL"

Configure PHP in Mac

Laravel is a PHP framework, so we need to install the latest PHP version using Homebrew.

You need to fire the following command from a command prompt:

brew install php

MySQL Installation

Of course, to store the data, we need a database and what else could be better than MySQL. We can download it through Homebrew package manager:

brew install mysql

Its easy to start the MySQL services, all it requires a given below command.

brew services start mysql

On MySQL startup the following message will be displayed on your terminal window:

=> Successfully started `mysql` (label: homebrew.mxcl.mysql)

Install Composer on MacOS

Composer is a package manager same like NPM. It helps you download the packages and libraries to amplify your application development workflow.

To install the composer, you need to run the following command.

sudo php -r "copy('','composer-setup.php');" 

The hash file code for composer verfies the installer.

php -r "if (hash_file('sha384', 'composer-setup.php') === '795f976fe0ebd8b75f26a6dd68f78fd3453ce79f32ecb33e7fd087d39bfeb978342fb73ac986cd4f54edd0dc902601dc') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Next, we execute the composer-setup.php file; it helps in installing the Composer package in the existing directory.

php composer-setup.php

Ultimately, we have to configure the composer globally in our development system. So, it would be best if you run the given below command, It will shift the composer. phar file to local user’s bin directory.

sudo mv composer.phar /usr/local/bin/composer

Verify the impetus of the Composer package manager installation.


Here is the similar output you will see on the terminal window.

  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
Composer version 1.10.8 2020-06-24 21:23:30

  command [options] [arguments]

Install Laravel Valet via Composer

Laravel Valet can be installed with just one command:

composer global require laravel/valet

Once installed, the following packages came along with it:

Changed current directory to /Users/digamber/.composer
Using version ^2.11 for laravel/valet
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 20 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-php80 (v1.18.1): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.18.1): Loading from cache
  - Installing symfony/var-dumper (v5.1.6): Downloading (100%)         
  - Installing tightenco/collect (v7.26.1): Downloading (100%)         
  - Installing nategood/httpful (0.3.2): Downloading (100%)         
  - Installing symfony/process (v5.1.6): Downloading (100%)         
  - Installing psr/container (1.0.0): Loading from cache
  - Installing php-di/invoker (2.1.0): Downloading (100%)         
  - Installing symfony/polyfill-intl-normalizer (v1.18.1): Loading from cache
  - Installing symfony/polyfill-intl-grapheme (v1.18.1): Loading from cache
  - Installing symfony/polyfill-ctype (v1.18.1): Loading from cache
  - Installing symfony/string (v5.1.6): Downloading (100%)         
  - Installing symfony/service-contracts (v2.2.0): Loading from cache
  - Installing symfony/polyfill-php73 (v1.18.1): Loading from cache
  - Installing symfony/console (v5.1.6): Downloading (100%)         
  - Installing mnapoli/silly (1.7.2): Downloading (100%)         
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing illuminate/contracts (v7.28.3): Downloading (100%)         
  - Installing illuminate/container (v7.28.3): Downloading (100%)         
  - Installing laravel/valet (v2.11.0): Downloading (100%)         
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files
11 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Run the following command to set the following folder with the path:


Now we need to install the Laravel Valet with given below command:

valet install

Create Laravel Application with Valet

In this final step, we learn how to run a laravel project using laravel valet’s link and park commands.

mkdir laravel

Get inside the project root:

cd laravel

Run the laravel valet park command:

valet park

The above command registers the existing laravel project directory as a path for Valet.

Create a new Laravel web application inside the same folder:

laravel new shop

With the following URL you can check out the laravel application that we installed via Valet.



Finally, we have completed the Laravel Valet tutorial. In this tutorial we learned how to install Laravel Valet in Mac and serve web application via Laravel valet.

Digamber - Author

Hi, I'm Digamber Singh, a New Delhi-based full-stack developer, tech author, and open-source contributor with 10+ years' experience in HTML, CSS, JavaScript, PHP, and WordPress.