When using Herd on macOS, it can sometimes interfere with globally installed Composer packages because Herd manages its own PHP environment. To resolve this issue, you need to ensure that the global Composer bin directory is included in your system's PATH. Here's how you can do it:
-
Locate the Composer global bin directory:
First, you need to find out where Composer is installing global binaries. You can do this by running:
composer global config bin-dir --absoluteThis command will output the path to the directory where Composer places global binaries, typically something like
~/.composer/vendor/binor~/.config/composer/vendor/bin. -
Add the Composer global bin directory to your PATH:
Once you have the path, you need to add it to your shell's PATH variable. If you're using
zsh, you can do this by editing your~/.zshrcfile:nano ~/.zshrcAdd the following line to the file, replacing
/path/to/composer/binwith the actual path you found in step 1:export PATH="$PATH:/path/to/composer/bin" -
Apply the changes:
After editing the
~/.zshrcfile, apply the changes by running:source ~/.zshrc -
Verify the installation:
Now, try running the
statamiccommand again:statamic new my-projectIf everything is set up correctly, this should work without any errors.
By ensuring that the global Composer bin directory is in your PATH, you should be able to use globally installed Composer packages even when using Herd.