,

How to install Drush in Windows?

Posted by

To install Drush for Drupal 10 on a Windows system, you can follow these steps:

Step 1: Install Composer

If you don’t already have Composer installed, follow these steps to install it:

  1. Download the Composer installer from getcomposer.org.
  2. Run the installer. Follow the instructions in the setup wizard. Make sure to install it globally so it can be used from any command line.

Step 2: Install Drush Using Composer

  • Open a command prompt (cmd) or PowerShell.
  • Navigate to your Drupal project directory (where your composer.json file is located). For example:
cd path\to\your\drupal\project
  • Install Drush as a project dependency by running the following command:
composer require drush/drush
  • Verify the installation by running the following command to check the Drush version:
vendor\bin\drush --version
  • This should output the version of Drush that was installed, indicating that the installation was successful.

Step 3: Add Drush to Your System Path (Optional)

To make Drush available globally from any command prompt, you can add it to your system’s PATH environment variable:

  1. Open the Start Menu, search for “Environment Variables,” and select “Edit the system environment variables.”
  2. In the System Properties window, click the Environment Variables button.
  3. In the Environment Variables window, find the Path variable in the System variables section and click Edit.
  4. In the Edit Environment Variable window, click New and add the path to Drush’s executable, which is typically:
  5. Replace C:\path\to\your\drupal\project with the actual path to your Drupal project.
C:\path\to\your\drupal\project\vendor\bin

6. Click OK to close all dialog boxes.

7. Open a new command prompt and type drush to verify that it is recognized globally.

Step 4: Using Drush with Drupal 10

  • Run Drush commands from the command line. For example, to clear the cache, you can use:
drush cr
  • Update Drush as needed by navigating to your project directory and running:
composer update drush/drush

Additional Tips

  • Ensure you have PHP installed and configured correctly on your system since Drush requires PHP to run.
  • Restart your command prompt or PowerShell session for the PATH changes to take effect.
  • If you encounter any issues, make sure that your Composer and PHP installations are up to date.

Drush Install Globally

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x