Globally Installing WP-CLI for Access Across Your System


When working on WordPress-based projects that utilize Composer, there are times that we’re going to want to have certain dependencies available for our project and there are times where we’re going to want to have tools available throughout our system. For example, for some projects, we may want to have PHP CodeSniffer with the WordPress Coding Standards available. For others, maybe not.
But having a tool like WP-CLI is something that’s likely better served when it’s available throughout the entire system rather than on a project-by-project basis. Globally installing WP-CLI is a relatively trivial matter.
It does, though, assume you have Composer already installed and available on your system.
Globally Installing WP-CLI
There are only three steps required to make this happen:
Define WP-CLI in Composer’s configuration,
Install the utility,
Make sure Composer’s vendor directory is in your .bash_profile (or the variables of whatever shell you want to use).
To update, add WP-CLI to Composer’s configuration, you can do this via command line by entering:
$ composer global require wp-cli/wp-cli
Or you can manually add it to the composer.json file by
Source: https://managewp.org/articles/14826/globally-installing-wp-cli-for-access-across-your-system




source https://williechiu40.wordpress.com/2017/04/10/globally-installing-wp-cli-for-access-across-your-system/