Short answer: Read the documentation.
Long answer: WP CLI needs to know your WordPress root directory. That is not platform, but software specific. This is also needed in Multisite and Network installs to determine the current site.
The easiest way to solve this is to use a YAML configuration file for WP CLI. Best is to place this in your users home directory so WP CLI searches from the root and upwards for it and uses the options provided there.
Related Posts:
- Detect if WP is running under WP-CLI
- WP CLI “Error establishing a database connection” in localhost (MAMP)
- wp-cli Enabling Maintainance Mode
- How do I run a PHP script from WordPress environment, like `wp shell`?
- Using wp-cli can I not query pages by their title?
- wp-cli 0.14.1 MySQL error
- WP-CLI Cannot Connect to Database due to Vagrant
- Changing the WP CLI cache folder
- WP-CLI Process Killed
- How to use wp-cli.yml file?
- wp-cli commands do nothing, return nothing
- WP cli –path does not seem to work
- Enable Auto-updates for all plugins using wp-cli? (since wordpress 5.5)
- How do I clone or duplicate a post with the WordPress Command Line Interface WP-CLI?
- How do I activate an mu-plugin with WP-CLI?
- WP-CLI get all posts from certain post type and taxonomy term
- How to create a WP-CLI command with $_POST?
- wp-cli doesn’t find and wordpress installation
- Does wp post delete also delete metadata associated with posts?
- WP-CLI :: Cannot installing plugin as www-data
- wp-cli import theme sample data
- WP-CLI works on non WP-CLI installed WordPress instance?
- Export list of users with first and lastname in WP-CLI
- WP-CLI – Return posts with matching meta key
- Prompt user for input in WP CLI
- What could cause WP-CLI search-replace to not replace all instances of a string?
- WP-CLI throwing PHP Fatal error: Call to undefined function apply_filters() [closed]
- WPCLI – update plugins, themes, and core, all in one row, instead 3 rows?
- Using Travis CI to run unit tests and running phpunit locally [closed]
- “Could not open input file” error even when WP-CLI is in the path
- Revert WordPress default options after a PHPUnit test has run
- Can I create multiple pages at once using WP-CLI?
- WP-CLI update date and time format
- WP-CLI over SSH – wp command not found
- wp-cli create post and media import
- Import Media To CPT with CLI & Filter Custom Taxonomy
- wp-cli with MAMP shows sh: mysql: command not found
- What is the difference between the Package Language and the Site Language?
- PHP warning are displaying when using WP CLI [closed]
- WP CLI – show users whose ID is larger than given ID
- How can I replace all regex matches using the WP_CLI search-replace tool
- How do I update a nested option?
- Is it possible to use WP-CLI via PHP-framework?
- Wp-cli-ssh global installation problem [closed]
- WP-CLI with theme: Uncaught Error: Class ‘WP_CLI’ not found
- WPCLI search and replace variants for all tables
- Can I create (or update) user password with WP-CLI by hash?
- Is there a way to pre-cache plugins with WP-CLI for faster installation?
- Allow download_url for lan addresses
- What tools respect `.distignore`?
- How to prevent WP-CLI shell from exiting when an exception occurs?
- wp-cli silently fails with 255 when running wp core install
- WP-CLI Get Site ID from its url
- WP-CLI alias: connect with ssh proxy
- Execute wp-cli command on all sites on server
- wp-cli: run post generate and post meta add together
- Setting boolean and array values using wp theme mod set
- Ask WP-CLI latest core WordPress version released
- How to change a post attribute to homepage using WP CLI?
- Unable to install plugins from wp-cli
- How can I get the WP-CLI eval-file command to report errors to stderr?
- WP-CLI sudden empty response
- How to get all posts related to a term with WP-CLI?
- WP CLI: there has been critical error
- In a continuous integration environment how do you implement the database entries for plugins and themes
- How to verify a correct wp-cli installation?
- wp-cli: wp term generate xxxxx – Error: ‘xxxxx’ is not a registered taxonomy
- How can I add an RSS widget using WP-CLI?
- MAMP PRO WP-CLI Error: Error establishing a database connection
- Shortest way to install WP-CLI
- “Class ‘Phar’ not found” error setting up WP-CLI with Cygwin
- Uninstall WP-CLI
- Running WP-CLI without SSH
- WP CLI Shell not working on Windows
- How do you kill WP-CLI execution?
- Is it possible to delete a range of posts by ID with WP-CLI?
- How to specify to wp-cli for the `wp config create` (`wp core config`) command that the DB user is an ‘all hosts’ user?
- Get last published post in WordPress using wp-cli
- WP Cli will not execute on Windows
- Formatting messed up when piping wp commands
- Where do the files of a custom WP CLI Command reside?
- wpcli: Error on post_content or post_title if accents
- wp-cli configuration in php?
- Does WP-CLI support updating multiple options via a single command?
- Lock User and Enforce Password change via wp-cli
- How to use wp db export and import together?
- BackupBuddy WP CLI Invalid Profile Error
- How to find what pages/posts contain a particular reusable block?
- WP CLI not finding plugin commands
- How can I search and replace by post type?
- WP CLI not outputting anything
- Only the WP CLI command, wp –info, runs under my cPanel account
- Error establishing a database connection when running phpunit
- WP-CLI search-replace posts content for certain URLs
- Set Site Icon programmatically (eg. using `wp cli`)
- Bulk remove custom post type and its attachments with wp-cli?
- Specify custom php.ini to use with WP-CLI
- How to rename default category name and slug using WP CLI?
- Resetting internal WordPress state during its cycle
- How do I add HTML code to a widget with wp-cli?