Question or problem
I’m relatively new to Tuist and wanted to see if it’s possible to create a small app that contains an embedded helper app as a LoginItem.
It seems that the macos_app_with_app_inside
example should do something like that, but it doesn’t really work.
Although the generated project does have the InnerApp
as a dependency, there is no Copy Files phase, so the built MainApp.app
does not contain the InnerApp.app
.
I then tried to add it using the main target’s copyFiles
property, but I can’t get it to work.
tl;dr
Is it possible to embed an app inside a macOS app using Tuist? Ideally without any build scripts.
Related Content
Looking through the issues / PRs on github I found the following:
The last message in the PR #4974 asks about whether to do the “product copy” changes in a separate PR, but there’s no answer and I couldn’t find anything.
However, in issue #1275, it says that support for this should’ve been added already.
The first two links are 2 years old and the other one 5 years, so I don’t know how relevant they still are.
Expectation
- Building the
macos_app_with_app_inside
example creates an app that has the other app embedded (inside)
- The
CopyFilesAction
can be used to reference the inner app (seems to only support files relative to the project’s directory)
Context
Reproduction (mandatory for problems)
For the example app:
- Run
tuist generate
in the fixtures/macos_app_with_app_inside
directory
- Build
MainApp
in Xcode
- No
InnerApp.app
inside the generated MainApp.app
Trying to use copyFiles:
- Specify
copyFiles
with .wrapper(name: "Embed", subpath: "Contents/Library/LoginItems", files: ...)
with one of the following files:
"InnerApp.app"
.folderReference(path: "\("${TARGET_BUILD_DIR}")/InnerApp.app")
"\("${TARGET_BUILD_DIR}")/InnerApp.app"
"${TARGET_BUILD_DIR}/InnerApp.app"
- Produces warning (No files found at …) and resulting copy files build phase has no files
Would be nice if someone could help me, or to just let me know in case it’s not possible.
Thanks!
Hey @thomasguenzel!
Would you mind creating a similar project to macos_app_with_app_inside
without Tuist, so that we can compare how Xcode is treating a macOS app depending on other macOS app? I’d like to understand if Tuist has diverged from Xcode’s default behavior or if this is more of a convenience feature.
Hey @marekfort,
it seems like I can’t upload files as a new user, but you should be able to access it using this link. Here is also a gif showing the steps.

After adding the other app as dependency it is necessary to manually add a copy files build phase.
I don’t think it’d make sense for Tuist to automatically copy added app dependencies into the LoginItems directory, this should be specified manually.
But so far I could not find a way to specify another product under copyFiles
, only files relative to the project’s directory. Or is there a way to do this?
Thanks
Thomas
I think that actually does make sense – Tuist takes control of how to integrate dependencies and embedding apps already has precedent in Tuist. We’re already embedding watchOS apps here: tuist/Sources/TuistGenerator/Generator/BuildPhaseGenerator.swift at main · tuist/tuist · GitHub
I’d suggest embedding macOS apps inside other macOS apps when one depends on the other. Would you raise an issue describing the scenario? Maybe you’d have time to also contribute this? The implementation should be very similar to the piece embedding a watchOS app.
In other words, when we detect a macOS app depends on another macOS app, we create a new copy build phase and embed it.
Since the app is copied to the LoginItems
directory, I wonder if assuming it’ll always be the case when two macOS apps depend on each other might not hold true for some cases.
In other words, should we provide an API that’s more of a escape hatch for cases like this.
I missed that’s a different directory than the app. Then yeah, I agree, an escape hatch might be a better solution.
Thank you so much for your answers! Really appreciate it.
Just checked a few apps and doesn’t seem like there is an agreed-upon place where to put apps (except LoginItems
).
Although far from a typical app, Xcode has many apps (like the Simulator, Instruments, etc) under /Contents/Applications/
. Microsoft Teams has two apps under /Contents/Helpers/
. The login item probably is the most common use case.
What do you mean by escape hatch? Wouldn’t it be enough to just add another case to CopyFileElement
, something like .product(name: String)
?
This would also remove the need for the install_cli.sh
in the macos_app_with_app_inside
example.
I’ll try to write an issue and maybe even look a little bit through the source code next week 
Hi 
By escape hatch I was thinking about an API that allows the consumer to bypass our dependency abstraction saying “I know what I’m doing here”. I don’t have a concrete shape for that API in mind, but I was thinking it could be something like allowing the developer to define a copy phase or target dependency manually.
This is amazing. I recommend that we start with the API in a new fixture, then let’s iterate on the API in that PR, once we are happy, we can give you the pointers to the changes that are needed to make that happen.