phpcomposer-phphomebrewdrush

Vendor folder missing after using brew to install Composer


I am trying to install Composer and Drush on my Mac for my Drupal website, but am running into an issue whenever I try to actually run a Drush command.

I followed these instructions to download and install composer and Drush, however, when I go to run a Drush command I get an error saying Drush is not found.

I believe the main issue is that export PATH="$HOME/.composer/vendor/bin:$PATH" does not work since my .composer directory doesn't have a vendor folder in it.

So somehow, when I ran brew install composer there was no vendor folder created, all that was created was a cache directory.

Why is the vendor folder missing after installing using brew?


Solution

  • Ensure composer is installed correctly

    You have installed composer on your macOS system with the command:

    brew install composer
    

    Ensure composer is installed and found in your PATH by running:

    which composer
    composer --version
    

    Installing drush

    1. Add composer's global bin-dir to your PATH environment variable

      export PATH="$(composer --global config --absolute bin-dir):${PATH}:"
      
    2. Install drush with the following command:

      composer global require drush/drush
      
    3. Verify drush has been installed correctly

      which drush
      drush --version
      

    To persist the changes to your PATH add the line from 1. to your shell's startup files (i.e. ~/.bashrc for bash or ~/.zshrc for zsh). Afterwards start a new shell-session.