Can't use WP-CLI // zsh: command not found: wp

Issue Summary

Cannot use WP-CLI in site shell, attempting to do so returns “zsh: command not found: wp”

Troubleshooting Questions

This happens for all of my Local sites, when attempting to invoke WP-CLI commands.

Replication

Open site shell, type “wp help”.

System Details

  • Which version of Local is being used?

7.0.1+6387 (but I’ve literally just updated, and observed this behaviour before updating, too)

What Operating System (OS) and OS version is being used?

MacOS Ventura 13.4, MacBook Pro M1

Attach the Local Log. See this Help Doc for instructions on how to do so:

I don’t expect this is necessary, appears to be a path issue. WP-CLI is present, as evidenced by the below, which is displayed when I launch the site shell:

Setting Local environment variables…
-—
WP-CLI: WP-CLI 2.7.1
Composer: 2.1.5 2021-07-23
PHP: 8.1.9
MySQL: mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
-—

I have gotten WP-CLI working, I installed it via Homebrew by running the following in Terminal:

brew install wp-cli

Though it is working, it spits out the following every time I run it, before doing what I’ve asked it to:

Failed loading /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/opcache.so: dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/opcache.so, 0x0009): tried: ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/opcache.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/opcache.so’ (no such file), ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/opcache.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’))
Failed loading /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so: dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): tried: ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so’ (no such file), ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’))

Warning: PHP Startup: Unable to load dynamic library ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so’ (tried: /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so (dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so, 0x0009): tried: ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so’ (no such file), ‘/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’))), /opt/homebrew/Cellar/php/8.2.7_1/lib/php/20220829//Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so (dlopen(/opt/homebrew/Cellar/php/8.2.7_1/lib/php/20220829//Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so, 0x0009): tried: ‘/opt/homebrew/Cellar/php/8.2.7_1/lib/php/20220829//Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/php/8.2.7_1/lib/php/20220829//Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so’ (no such file), ‘/opt/homebrew/Cellar/php/8.2.7_1/lib/php/20220829//Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-8.1.9+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so’ (no such file))) in Unknown on line 0

1 Like

Hi @mrsippy -

Thank you for sharing what worked for you and that extra context.

Is there anything else we can support you with on this question?

Thanks!

Sam

Hi Sam,

It’d be great to know how to get rid of those errors I’m seeing, that I mention in my second post.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.