I have a specific error which depends on the packages installed in environment, to reproduce this error on the developer org, I need all the installed packages to install into development org.

Can I write a simple SFDX Script to copy all installed packages from one org to another one to automate this rather than having to install all of these manually?

1 Answer 1


The following script can be used

for OUTPUT in $(sfdx force:package:installed:list -u $1 --json | jq '.result [] .SubscriberPackageVersionId'  -r)
    sfdx force:package:install -u $2 -w 500 -p  $OUTPUT -r 
  • Nice. See also this answer I wrote where you create a mdapi-style folder with a package.xml, and Salesforce can automatically install all the specified packages, with passwords, if necessary, in a single force:mdapi:deploy command.
    – sfdcfox
    May 12, 2021 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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