Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
Last active October 21, 2024 10:01
Show Gist options
  • Save bradtraversy/b58f74cd863a465068eaeaae1544d9be to your computer and use it in GitHub Desktop.
Save bradtraversy/b58f74cd863a465068eaeaae1544d9be to your computer and use it in GitHub Desktop.
Laravel Valet install on mac

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

Install Laravel Installer

composer global require laravel/installer

Create a Laravel Project

Make sure you go to where you want to create your project folder

laravel new PROJECT_NAME

Tell Valet to use the current folder for Laravel projects

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
@meghakundar
Copy link

valet is not installing... what to do? image

Currently I'm using linux... so is there any solution?

You can try using in this way
~/.composer/vendor/bin/valet install
This worked me
I got this answer through this thread -> https://stackoverflow.com/questions/37085102/laravel-valet-install-not-found

@shamotamaria
Copy link

Hi, I see errors after installing a valet and my project is not available. I tried to reinstall valet with no luck.
Screen Shot 2023-12-27 at 12 48 04
Any ideas?

@lscfrancisco
Copy link

in case error command valet.

Solution:

In 2019, Apple made the switch from bash to zsh as the default shell in macOS Catalina and subsequent versions. To switch to the zsh shell, you can use the following command:

echo "export PATH=$PATH:$HOME/.composer/vendor/bin" >> ~/.zshrc

@php10xdev
Copy link

Following the steps after i do laravel new PROJECT_NAME, getting error:

Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /.composer/vendor/laravel/installer/src/NewCommand.php:818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment