Error installing CLI packages - Fatal error: Allowed memory size exhausted

Do you have other composer packages installed? That error mentions a memory size of 268435456 which is just a touch over a typical default limit of 256M – I wonder if there’s some other default memory setting that is being referenced somewhere.

Also, that stack trace appears to be referencing Local’s version of wp-cli – so I think that the shell is configured correctly, but just to double check, let’s see what version of PHP and wp-cli is being used. Within that site shell, can you run these commands:

which php; php --version; which wp; wp --version
echo $SHELL; echo $PATH | tr ':' '\n'

What we’re looking for is to verify that there isn’t some other path pollution happening, for example, some other configuration of PHP, or perhaps a global composer configuration.

Here’s what mine looks like: