If you’re using macOS Catalina (or later depending on when you’re reading this post) and you’re also running a combination of:
- Oh My Zsh
- An IDE (such as Code)
- Composer
- and PHP CodeSniffer
And you’re using the latter installed at a global level but your IDE nor your terminal sessions are able to pick it up, make sure that you’ve updated your path.
Remember:
Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration.
Oh My ZSH
This means if you’re going to make any changes to your path, you need to update ~/.zshrc
.
PHPCS with Oh My Zsh
If you’ve installed PHP CodeSniffer but your system is unable to find it, use the following steps…
1. Update Your Configuration
Assuming that all of the necessary packages are installed, add the following to ~/.zshrc
:
export PATH=$HOME/bin:/usr/local/bin:/Users/[your-user-name]/.composer/vendor/bin:$PATH
2. Source Your Configuration
Then run the following command in your terminal:
source ~/.zshrc
3. Test Your Update
Finally, you can run which phpcs
to verify that your operating system is able to find PHPCS and can use it throughout terminal sessions, your IDE, or any other tools that may rely on it.