# Packaging instructions for macOS

**URL:** <https://discourse.slicer.org/t/packaging-instructions-for-macos/15632>\
**Category:** Development\
**Created:** [January 22, 2021, 3:08pm UTC](https://discourse.slicer.org/t/packaging-instructions-for-macos/15632 "2021-01-22T15:08:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pll\_llq](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pll_llq/32/9408_2.png) [@pll\_llq](https://discourse.slicer.org/u/pll_llq)\
**Post date:** [January 22, 2021, 3:08pm UTC](https://discourse.slicer.org/t/packaging-instructions-for-macos/15632/1 "2021-01-22T15:08:16Z")

</div>

Hi,

I’ve successfully built Slicer from source on macOS 11.1 but I am having trouble packaging the app. I’ve tried building with Qt installed from a web-installer and from homebrew.

When I try to package Slicer build with Qt from the web-installer the log shows lots of `@rpath` errors like

```auto
warning: target '@rpath/QtGui.framework/Versions/5/QtGui' is not absolute...
warning: target '@rpath/QtGui.framework/Versions/5/QtGui' does not exist...
error: /Applications/DevelopmentTools/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: @rpath/QtGui.framework/Versions/5/QtGui (No such file or directory)

```

and the packaged app doesn’t run on the machine it was built.

When I do the same with the Qt that’s installed from homebrew there are no errors and the app launches on the machine it was built on but when I try to launch the app on a different machine the app crashes with an error saying a library was not loaded/found

```auto
Dyld Error Message:\
  dyld: Using shared cache: 467A83CB-BA86-3F07-B652-B9256C74080A\
Library not loaded: /usr/local/opt/lz4/lib/liblz4.1.dylib\
  Referenced from: /Applications/Slicer.app/Contents/lib/Slicer-4.13/libarchive.17.dylib\
  Reason: image not found\

```

The `rpath` issue was discussed in a number of posts here, like [this one](https://discourse.slicer.org/t/slicer-packaging-qt5-libraries-link/3583) and [this one](https://discourse.slicer.org/t/build-error-on-macosx-and-linux-with-itkpython-enabled/3277/18) and most important [this one](https://discourse.slicer.org/t/osx-slicer-qt5-packaging-error/1468/6)

From the forum posts it appears that the only way to create a Slicer (or a Slicelet) for distribution to end-users is to build Qt from source. Is it the only option? Might there be another solution that involves an extra step between building Slicer and running `make package` in the `Slicer-build` folder?

Any advice is appreciated.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 22, 2021, 3:32pm UTC](https://discourse.slicer.org/t/packaging-instructions-for-macos/15632/2 "2021-01-22T15:32:42Z")

</div>

Your understanding is correct, it is not practically feasible to create standalone installation packages if you use homebrew. You need to build Qt from source. This is described in the [build instructions](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/macos.html#prerequisites), but apparently te instructions are not clear enough. Please send a pull request with suggestions for wording changes, which will make things more clear for future developers.

---

<div class="post-metadata">

**Author:** ![pll\_llq](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pll_llq/32/9408_2.png) [@pll\_llq](https://discourse.slicer.org/u/pll_llq)\
**Post date:** [January 22, 2021, 5:28pm UTC](https://discourse.slicer.org/t/packaging-instructions-for-macos/15632/3 "2021-01-22T17:28:16Z")

</div>

Thanks for clarifying this, @lassoan  
I hoped there might be an easier solution like setting some `DYLD` path or using `install_name_tool` before packaging.

* * *

Also, can you explain the following line from the instructions:

> If `using Qt from the system` , do not forget to add the following CMake variable to your configuration command line: `-DSlicer_USE_SYSTEM_QT:BOOL=ON`

Does `using Qt from the system` relate to the use case when Qt was built from source?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 22, 2021, 5:55pm UTC](https://discourse.slicer.org/t/packaging-instructions-for-macos/15632/4 "2021-01-22T17:55:09Z")

</div>

If you want to create installation packages then you need to build Qt yourself and set `Slicer_USE_SYSTEM_QT:BOOL=OFF`.

---

<div class="post-metadata">

**Author:** ![pll\_llq](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pll_llq/32/9408_2.png) [@pll\_llq](https://discourse.slicer.org/u/pll_llq)\
**Post date:** [January 22, 2021, 6:07pm UTC](https://discourse.slicer.org/t/packaging-instructions-for-macos/15632/5 "2021-01-22T18:07:33Z")

</div>

Thank you very much 👍
