Hive Hive
Sign in

Macros cannot be expanded when using cache

GitHub issue · Open

Metadata
Source
tuist/tuist #5987
Updated
Jun 11, 2026
Domains
Cache
Details

What happened?

When I use tuist cache macros work, however they cannot be expanded

How do we reproduce it?

  1. Download attached project framework_with_native_swift_macro.zip

  2. tuist install

  3. tuist generate

  4. open Framework.swift

  5. Right click on @Reducer -> Expand macro option is visible

  6. tuist cache

  7. tuist generate

  8. Right click on @Reducer

Expected: Expand macro option is visible

Actual: Expand macro option is not visible

Error log

macOS version

14.1

Tuist version

4.3.4

Xcode version

15.2

Comments
P
pepicrft Feb 24, 2024

Thanks for reporting this @JaroVoltix. We added it to the list of issues to look into.

MA
mihaicris-adoreme Apr 16, 2024

Hi. I ran into this issue as well and I wonder if it will be addressed soon. I started using Mockable, https://github.com/Kolos65/Mockable.git, and if I cache this dependency I cannot expand the macros.

I also found a defect which is more serious, not sure if it is Tuist or Mockable, but when I use Mockable in a SPM package to create mocks, and try to import the Mock generated classes from the SPM module in another target (main app for example) the classes are not found, even if they are generated with public access control. I will try to make a project sample and create another issue.

V
vvisionnn Jun 27, 2024

met this issue too, it is quite annoying by choosing between the macro expansion and binary cache @pepicrft do we have some conclusion for this?

P
pepicrft Jun 27, 2024

I haven’t been able to looked into it yet. My hunch is that it’s a bug in Xcode’s editor when the Swift Macro is provided as a compiled executable (to confirm). If that’s the case, I’ll have to file a radar and provide an example project for Apple to look into the issue.

P
pepicrft Jun 27, 2024

@mihaicris-adoreme could it be that you are missing the MOCKING compiler directive that that macro requires? We are using it in Tuist, and we haven’t encountered any issue.

L
lu15gv Aug 30, 2024

We have the same problem and had to pause macro integration as we prefer to use cache. @pepicrft were you able to see if it was a problem with the xcode editor?

D
dosubot[bot] Sep 12, 2025

Hi, @JaroVoltix. I’m Dosu, and I’m helping the tuist team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that Swift macros fail to expand in Xcode when using Tuist cache, with the “Expand macro” option disappearing after caching.
  • The problem occurs on macOS 14.1, Tuist 4.3.4, and Xcode 15.2.
  • Other users have confirmed the issue and expressed frustration over the trade-off between macro expansion and binary caching.
  • A maintainer suspects this might be an Xcode editor bug related to macros as compiled executables and is considering filing a radar with Apple.
  • The issue is still under investigation with no resolution so far.

What’s Next:

  • Please let me know if this issue is still relevant with the latest version of Tuist by commenting here to keep the discussion open.
  • Otherwise, I will automatically close this issue in 7 days.

Thanks for your understanding and contribution!

H
hiltonc Sep 21, 2025

This is still relevant with Tuist 4.78.0.