-1

I'm trying to install Valet following an official Laravel documentation. So I installed Homebrew first by using:

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

I can confirm it was installed by running which brew which returns /opt/homebrew/bin/brew.

Installed PHP 8.2 by running brew install php.

PHP 8.2.8 (cli) (built: Jul  6 2023 10:57:44) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies

Installed Composer by running the following:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

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

I can tell that the ~/.composer/vendor/bin directory is definitely in my system's "PATH" by running echo $PATH which returns:

/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/CyberArk EPM.app/Contents/Helpers:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/galopom/WebDev/galopom/node_modules/.bin:/Users/galopom/.composer/vendor/bin

After Composer has been installed, I installed Laravel Valet as a global Composer package:

composer global require laravel/valet

But when I run valet install I get Valet requires Homebrew to be installed on your Mac..

Apple M1 Pro, MacOS - 13.4.1 (22F82)

I'm literally spinning in circles, could anyone please help?!

Deniss Muntjans
  • 369
  • 10
  • 35

2 Answers2

0

I prefer use bash, go to Terminal preferences to change zsh to bash

Don't use SUDO for move composer.phar to /usr/local/bin/composer !

THEN add this code in your .bash_profile

# BREW
export PATH="/usr/local/sbin:$PATH"

# COMPOSER
export PATH="/Users/YOUR_USER_NAME/.composer/vendor/bin:$PATH"

# NODE ET NPM
export PATH="/usr/local/bin:$PATH"
export PATH="/Users/YOUR_USER_NAME/.npm-packages/bin:$PATH"
unset NODE_OPTIONS

# MYSQL VIA BREW
export PATH="/usr/local/opt/mysql/bin:$PATH"

# PHP VIA BREW
export PATH="/usr/local/opt/php@8.2/bin:$PATH"
export PATH="/usr/local/opt/php@8.2/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/php@8.2/lib"
export CPPFLAGS="-I/usr/local/opt/php@8.2/include"
Boss COTIGA
  • 893
  • 7
  • 15
0

I think it's related to your PATH configuration, but first of all try to manually install Valet using the Homebrew package manager

like this :

   brew install php
   brew install composer
   composer global require laravel/valet
   valet install

and if the issue persists,open your terminal and check your brew like this :

brew --version

and if Homebrew is installed correctly, it should display the version number, now check if the Homebrew executable is included in your PATH, like this :

echo $PATH

check /opt/homebrew/bin is included in your output!

good luck !

Freeman
  • 9,464
  • 7
  • 35
  • 58