---
schema_version: "1"
id: 63524b13ad38ad5f2b9317c00b07d89768e1676a3f2b55cd27d15ca9fa945a2f
title: When to Use Scratch Org Snapshots in Package Development
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform-pkg-exchange/managed_packaging/guides/second-generation/dev2gp-so-when-use-snapshot.md
canonical_url: https://developer.salesforce.com/docs/platform/pkg2-dev/guide/dev2gp-so-when-use-snapshot.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ab1b614a710334c055cde60b960020ebf439642993282df63ecaff30bc13bfb3
products:
  - Second-Generation Managed Packaging Developer Guide
  - merged-docs
---

# When to Use Scratch Org Snapshots in Package Development

If the managed 2GP or unlocked package that you’re building depends on one or more large packages, it can take a long time for the package version creation CLI command to complete. Let’s talk about why that occurs, and how scratch org snapshots can dramatically reduce how long it takes to create a new package version.

When you run the `package version create` CLI command, we create a scratch org behind the scenes. That scratch org serves as a build org where we build your package. In the build org we install the dependent packages you specified, and deploy the package metadata for the package version you're creating. If your dependent packages are large, the package install time for those dependent packages extends the overall package creation time.

If the dependent packages that your base package requires are stable, you can reduce the end-to-end package version creation time by creating a scratch org snapshot, and using that scratch org snapshot during package version creation.

A [scratch org snapshot](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_snapshots_intro.htm) captures the state of a scratch org’s configuration so that you can use the snapshot to create scratch org replicas. A snapshot is a point-in-time copy of a scratch org that includes installed packages, features, limits, licenses, metadata, and data. If you install your dependent packages in the scratch org before you create the snapshot, and you specify the snapshot when you create a new package version, the package build process bypasses these steps. Meaning, we don't install the dependent packages into the build org, we use the snapshot instead. By not installing the dependent packages during package version creation, your package version builds in a fraction of the time.

Keep in mind, the intention of scratch org snapshots in the package development cycle is to shorten the package creation time during development. When you are ready to promote and release a package, you must create a new package version that doesn’t rely on a scratch org snapshot. Package versions created using scratch org snapshots can’t be promoted to the released state.

**note:** You can promote an [unlocked package](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_intro.htm) based on a snapshot. Only managed packages based on snapshots can’t be promoted to the released state.

**See Also**

- [Create a Package Version Based on a Scratch Org Snapshot](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/dev2gp-so-pkg-snapshot.md)
- [_Salesforce DX Developer Guide_: Scratch Org Snapshots](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_snapshots_intro.htm)
