diff --git a/diskimage_builder/elements/package-installs/README.rst b/diskimage_builder/elements/package-installs/README.rst
index 329d9c48b..4660b9753 100644
--- a/diskimage_builder/elements/package-installs/README.rst
+++ b/diskimage_builder/elements/package-installs/README.rst
@@ -30,6 +30,8 @@ example ``package-installs.yaml``
     dib_python_version: 2
   python3-dev:
     dib_python_version: 3
+  libssl-dev:
+    build-only: True
   package-a:
     when: DIB_USE_PACKAGE_A = 1
   package-b:
@@ -60,6 +62,11 @@ Setting the installtype property causes the package only to be installed if
 the specified installtype would be used for the element. See the
 diskimage-builder docs for more information on installtypes.
 
+Setting ``build-only`` will cause the package to be added both to the
+list of packages to be installed and to the list of packages to be
+uninstalled. This allows expressing build-time dependencies that should
+not end up in the final image.
+
 The ``arch`` property is a comma-separated list of architectures to
 install for.  The ``not-arch`` is a comma-separated list of
 architectures the package should be excluded from.  Either ``arch`` or
diff --git a/diskimage_builder/elements/package-installs/bin/package-installs-squash b/diskimage_builder/elements/package-installs/bin/package-installs-squash
index 04c31a4cf..7ba71dad1 100755
--- a/diskimage_builder/elements/package-installs/bin/package-installs-squash
+++ b/diskimage_builder/elements/package-installs/bin/package-installs-squash
@@ -113,9 +113,11 @@ def collect_data(data, objs, element_name):
         if not params:
             params = {}
         phase = params.get('phase', 'install.d')
-        install = "install"
+        installs = ["install"]
         if 'uninstall' in params:
-            install = "uninstall"
+            installs = ["uninstall"]
+        if 'build-only' in params:
+            installs = ["install", "uninstall"]
 
         # Filter out incorrect installtypes
         installtype = params.get('installtype', None)
@@ -136,7 +138,8 @@ def collect_data(data, objs, element_name):
             continue
 
         if valid_installtype and valid_arch and valid_dib_python_version:
-            data[phase][install].append((pkg_name, element_name))
+            for install in installs:
+                data[phase][install].append((pkg_name, element_name))
 
     return data