Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
Last active April 25, 2024 06:41
Show Gist options
  • Star 97 You must be signed in to star a gist
  • Fork 42 You must be signed in to fork a gist
  • 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
@Kamalkoranga
Copy link

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

@Kamalkoranga
Copy link

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

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

@gladiatorgiftson
Copy link

@Kamalkoranga valet is not supported on Linux you can use valet-linux and add composer
export PATH=$PATH:~/.config/composer/vendor/bin
on .bashrc on bash

@kmanship
Copy link

kmanship commented Jun 18, 2022

If you get "404 - Not Found" when visiting http://laragigs.test/, run the following in your project directory:

valet link

@garos4
Copy link

garos4 commented Jun 28, 2022

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

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

Try restarting your terminal. That should work

@xmyoot
Copy link

xmyoot commented Jul 16, 2022

@nurul-umbhiya
Copy link

nurul-umbhiya commented Aug 11, 2022

valet link && valet secure. This will create a TLD domain for you to access WordPress and to do so via https://.

@duikb00t
Copy link

valet link --secure

Can be a shorthand for link and secure in 1 line.

@fayeznasri
Copy link

fayeznasri commented Jan 11, 2023

after adding composer to the PATH (open ~/.zshrc > add the commande: export PATH="$HOME/.composer/vendor/bin:$PATH" )then try the commands:

  • composer global require laravel/valet command -v valet
  • ln -s ~/.composer/vendor/bin/valet /usr/local/bin/valet
  • valet install
  • composer global update

@kevineriksson
Copy link

code ~/.zshrc I cant open it in Mac Ventura. The outcome is "-bash: code: command not found". Please help

@duikb00t
Copy link

You ha

code ~/.zshrc I cant open it in Mac Ventura. The outcome is "-bash: code: command not found". Please help

What does: echo $SHELL give you?

@prfct-abs
Copy link

kevineriksson

Try other text editor like vim like "vim ~/.zshrc" and add the path. Hope this helps.

@bitcooker
Copy link

code ~/.zshrc I cant open it in Mac Ventura. The outcome is "-bash: code: command not found". Please help

  • Launch VS Code
  • Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command:
    Install 'code' command in PATH command.

@YanceMcFinn
Copy link

Stuck at installing composer. "composer" didn't show up in the result when I tried echo $PATH. I edited the .bashrc file with the line provided, then closed my terminal and restarted it. The echo command still shows the same result. No composer to be found.

@zoegongar
Copy link

Where it says " Add this line and save", really means, "replace the content"

@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

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