# Install 3rd party macOS installer package

**URL:** https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026
**Category:** Usage
**Tags:** os:macos
**Created:** [September 21, 2023, 4:09am UTC](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026 "2023-09-21T04:09:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Mahesh](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/9dc877/32.png) [@Mahesh](https://discourse.cmake.org/u/Mahesh)
#### Post date: [September 21, 2023, 4:09am UTC](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026/1 "2023-09-21T04:09:48Z")

</div>

I am using CPack module in CMake to generate the product installer on macOS. I am trying to install a 3rd party macOS installer package as a prerequisite to our product installer. I tried -

```auto
add_executable(
    XYZ
    IMPORTED
)

set_property(
    TARGET XYZ PROPERTY
    IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/import/redist/XYZ.pkg 
)

install(
    IMPORTED_RUNTIME_ARTIFACTS
        XYZ
    COMPONENT
        XYZ
)

```

However, this doesn’t install the XYZ.pkg though it is part of my final product installer pkg file. Is this the correct way to embed and install 3rd party installer package from my product package installer ?

**Edit:** Instead of executing the XYZ.pkg installer to install it’s components, my product installer is copying it to my product’s destination folder. I was expecting to chain the install instead.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [September 22, 2023, 4:10pm UTC](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026/2 "2023-09-22T16:10:07Z")

</div>

In my understanding your usage can‘t work.

See [install(IMPORTED\_RUNTIME\_ARTIFACTS...) does not work on Darwin (OSX)](https://discourse.cmake.org/t/install-imported-runtime-artifacts-does-not-work-on-darwin-osx/9018) for an example

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 24, 2023, 12:38am UTC](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026/3 "2023-09-24T00:38:59Z")

</div>

AFAIK, there is no mechanism to install a `.pkg` file without interaction that works universally. In any case, CMake doesn’t have a way to install such a package automatically. If `.pkg` supports chaining to other `.pkg` files, that is something very CPack-generator-specific rather than generic CMake infrastructure.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 24, 2023, 2:50am UTC](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026/4 "2023-09-24T02:50:37Z")

</div>

If you are using the `productbuild` CPack generator, you may be able to get the behavior you’re after using [`CPACK_PREFLIGHT_<COMP>_SCRIPT`](https://cmake.org/cmake/help/latest/cpack_gen/productbuild.html#variable:CPACK_PREFLIGHT_%3CCOMP%3E_SCRIPT) or [`CPACK_POSTFLIGHT_<COMP>_SCRIPT`](https://cmake.org/cmake/help/latest/cpack_gen/productbuild.html#variable:CPACK_POSTFLIGHT_%3CCOMP%3E_SCRIPT).
