drush and cv have both have commands to install extensions. But know I want to create a script that sets the CiviCRM components. Is it possible to do this?

2 Answers 2


Thanks to passing JSON objects to drush cvapi I found a solution:

echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | drush cvapi Setting.create --in=json

For those that use cv is also possible to use:

echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | cv api Setting.create --in=json
  • For API4, the syntax is: echo '{"values":{"enable_components":["CiviContribute","CiviMember","CiviReport"]}}' | cv api4 Setting.set --in=json or cv api4 Setting.set '{"values":{"enable_components":["CiviContribute","CiviMember","CiviReport","CiviPledge"]}}'.
    – Martin_W
    Commented Mar 21, 2021 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.