Skip to content

Fix MacOS build#837

Closed
zeyus wants to merge 12 commits intocommetchat:mainfrom
zeyus:feature/osx-build
Closed

Fix MacOS build#837
zeyus wants to merge 12 commits intocommetchat:mainfrom
zeyus:feature/osx-build

Conversation

@zeyus
Copy link
Copy Markdown

@zeyus zeyus commented Mar 13, 2026

THIS PR IS NOW SUPERSEDED BY:

I have access to an MacOS computer (and iPads), so I thought I could have a stab at getting the build working. I've been working a lot with dart and flutter for my research platform, and have had to deal with some similar issues (with the exception of rust libs, I've been using C FFI native libs).

I'm looking for some feedback on this PR, both in terms of scope and how you would like to have it chunked.

What this PR does:

  • Makes the build for MacOS work
    • Adds required entitlements and Info.plist entries
  • Allows commet to launch and work on MacOS, including connecting to a homeserver, seeing messages, etc
  • Fix iOS and MacOS emoji display
  • Fix entitlements and permissions required for sending/saving files, camera access, mic access
  • Working voice and video calls (MacOS) / element call / livekit / matrix-rtc
  • Working voice, maybe video (iOS) - the iOS simulator video / webcam thing didn't work, but it is possible on a real device that it works

important: While using the main github version of the apple media_kit_* packages fixes the main problem that broke the build, obviously pointing to the head of a repo is dangerous. Would you prefer:

  • Pointing to a specific commit hash
  • That I make a fork / branch
  • That commetchat org makes a fork / branch

any is fine for me, once I know I can update the PR.

Thanks!

Test builds
ios: https://mega.nz/file/5k5HGDhb#RosZgXD-unwdw5Sozvlqvz7pPAxHjPcmIFYu5XAyv-M (will need to be sideloaded, it's an iOS .app)
macos: https://mega.nz/file/EkQiXByb#PhF6KuGEsG3r1ILT8TL_pwKzQXaqDsdXHnTJWwl1tfY

Edit: I wanted to make it clear that none of the changes in the PR, nor the text above used generative AI.

@Airyzz
Copy link
Copy Markdown
Contributor

Airyzz commented Mar 14, 2026

Thank you for the PR!

If i'm not mistaken, this looks like mostly a duplicate of the work done in #525. probably the best approach would be for me to merge that PR in to main, and then you can apply your changes over the top of that

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Mar 14, 2026

Thank you for the PR!

If i'm not mistaken, this looks like mostly a duplicate of the work done in #525. probably the best approach would be for me to merge that PR in to main, and then you can apply your changes over the top of that

The original reply below is no longer relevant, this has diverged a fair bit from the original of just updating the xcode project files.

I think that's a good idea, I can make this PR dependent on that one, I missed it completely.

But there are some things missing from that PR

  • no Info.plist changes to required permission
  • no .entitlements (without plist and entitlements no mic/cam/etc support)
  • no media lib changes, the build fails without using the patched /head version

So I think both are beneficial

@zeyus zeyus mentioned this pull request Mar 18, 2026
@zeyus
Copy link
Copy Markdown
Author

zeyus commented Mar 18, 2026

@Airyzz I've made some additional changes and now commet is fully functional on MacOS. I connected to my matrix homeserver and started using it :)

I'm still happy to build off the other PR if necessary

@zeyus zeyus marked this pull request as ready for review March 18, 2026 11:40
@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 5, 2026

@Airyzz this now successfully builds for iOS too

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 6, 2026

And the Emoji display on iOS and MacOS is now fixed, as well as some other permission/sandbox/entitlements related problems.

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 6, 2026

@sanderDijkxhoorn
Copy link
Copy Markdown

sanderDijkxhoorn commented Apr 10, 2026

L"), logicalKey: LogicalKeyboardKey#31e2c(keyId: "0x0000006c", keyLabel: "L", debugName: "Key L"), character: "l", timeStamp: 21:32:40.001776)
Another exception was thrown: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests,
please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyDownEvent#d6352(physicalKey: PhysicalKeyboardKey#9a7be(usbHidUsage: "0x0007000f", debugName: "Key
L"), logicalKey: LogicalKeyboardKey#31e2c(keyId: "0x0000006c", keyLabel: "L", debugName: "Key L"), character: "l", timeStamp: 21:32:40.001776)
flutter: [Commet (main)] Failed to get state from event key
flutter: [Commet (main)] Failed to get state from event key
Another exception was thrown: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests,
please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyDownEvent#d6352(physicalKey: PhysicalKeyboardKey#9a7be(usbHidUsage: "0x0007000f", debugName: "Key
L"), logicalKey: LogicalKeyboardKey#31e2c(keyId: "0x0000006c", keyLabel: "L", debugName: "Key L"), character: "l", timeStamp: 21:32:40.001776)
flutter: [Matrix] No more events found in the store. Request from server...
Another exception was thrown: Incorrect use of ParentDataWidget.
flutter: [Commet (main)] Disposing room timeline for: admin-chat 
Another exception was thrown: ScrollController not attached to any scroll views.
Another exception was thrown: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests,
please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyDownEvent#d6352(physicalKey: PhysicalKeyboardKey#9a7be(usbHidUsage: "0x0007000f", debugName: "Key
L"), logicalKey: LogicalKeyboardKey#31e2c(keyId: "0x0000006c", keyLabel: "L", debugName: "Key L"), character: "l", timeStamp: 21:32:40.001776)
Another exception was thrown: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests,
please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyDownEvent#d6352(physicalKey: PhysicalKeyboardKey#9a7be(usbHidUsage: "0x0007000f", debugName: "Key
L"), logicalKey: LogicalKeyboardKey#31e2c(keyId: "0x0000006c", keyLabel: "L", debugName: "Key L"), character: "l", timeStamp: 21:32:40.001776)
Another exception was thrown: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests,
please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyDownEvent#d6352(physicalKey: PhysicalKeyboardKey#9a7be(usbHidUsage: "0x0007000f", debugName: "Key
L"), logicalKey: LogicalKeyboardKey#31e2c(keyId: "0x0000006c", keyLabel: "L", debugName: "Key L"), character: "l", timeStamp: 21:32:40.001776)

Can confirm, building and running the macOS version using this PR works, emojis menu seems to function fine but I can't type any text.

This is fully functional on your build/machine(s)?

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 10, 2026

Can confirm, building and running the macOS version using this PR works, emojis menu seems to function fine but I can't type any text.

This is fully functional on your build/machine(s)?

Oh, that's a strange one. I tested on macOS 26 and iOS 26. I sent messages in a Matrix space in a part of to share this particular build and to test it.

What's the details of the system you are running it on? Did you use the prebuilt app or did you build yourself?

I'm away from my Mac right now but I could share the exact build command I used for it if it is helpful.

@sanderDijkxhoorn
Copy link
Copy Markdown

Can confirm, building and running the macOS version using this PR works, emojis menu seems to function fine but I can't type any text.
This is fully functional on your build/machine(s)?

Oh, that's a strange one. I tested on macOS 26 and iOS 26. I sent messages in a Matrix space in a part of to share this particular build and to test it.

What's the details of the system you are running it on? Did you use the prebuilt app or did you build yourself?

I'm away from my Mac right now but I could share the exact build command I used for it if it is helpful.

I have build it myself. I ran the command from the readme.

cd commet
flutter run --dart-define BUILD_MODE=debug --dart-define PLATFORM=macos

should be this^

Apple Sillicon, should be macOS 26.4.1 for that device.

@Airyzz
Copy link
Copy Markdown
Contributor

Airyzz commented Apr 11, 2026

Hi, thanks again for all your work on this!! I've merged #525 in to main! if you wouldn't mind, could you apply your fixes on top of this, and split this big PR in to a series of smaller PRs, it would be much easier for me to review and (hopefully) merge

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 11, 2026

I have build it myself. I ran the command from the readme.

cd commet
flutter run --dart-define BUILD_MODE=debug --dart-define PLATFORM=macos

should be this^

Apple Sillicon, should be macOS 26.4.1 for that device.

That should be Ok. Did you run the code gen step? It may also be worth trying to run pod install manually from the macOS directory.

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 11, 2026

Hi, thanks again for all your work on this!! I've merged #525 in to main! if you wouldn't mind, could you apply your fixes on top of this, and split this big PR in to a series of smaller PRs, it would be much easier for me to review and (hopefully) merge

Will do. I probably can't break down the xcode stuff to much, but I can definitely split it into iOS/macOS and the other code changes for emoji and the exception

@zeyus zeyus closed this Apr 11, 2026
@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 11, 2026

@Airyzz Done :)

I just realized though that maybe the PR 3 and 4 should be done first - because the build will fail due to the dependency issues (vodozemac + mediakit). But it doesn't build at the moment anyway so I don't think it's a major issue.

@zeyus
Copy link
Copy Markdown
Author

zeyus commented Apr 11, 2026

@sanderDijkxhoorn

I have build it myself. I ran the command from the readme.

cd commet
flutter run --dart-define BUILD_MODE=debug --dart-define PLATFORM=macos

should be this^

Apple Sillicon, should be macOS 26.4.1 for that device.

I just checked on my Macbook, these were the build steps I used, I didn't include the --dart-define BUILD_MODE=XXX but I guess that probably should have been in my build/run step, I didn't look at the script to see what uses it.

both:

dart run scripts/codegen.dart

then

iOS:

flutter build ipa --build-name=v0.0.1 --release --dart-define PLATFORM=ios --dart-define GIT_HASH=faeb54f66ca6bfbc77b15f638467051757a04c5a --dart-define VERSION_TAG=v0.0.1 --dart-define ENABLE_GOOGLE_SERVICES=false

macOS:

flutter build macos --build-name=v0.0.1 --release --dart-define PLATFORM=macos --dart-define GIT_HASH=faeb54f66ca6bfbc77b15f638467051757a04c5a --dart-define VERSION_TAG=v0.0.1 --dart-define ENABLE_GOOGLE_SERVICES=false


or using flutter run

iOS:
flutter run --debug --dart-define PLATFORM=ios --dart-define GIT_HASH=3bf5ef92abe6cb97f799801e1f4c387d63278cb6 --dart-define VERSION_TAG=v0.0.0 --dart-define ENABLE_GOOGLE_SERVICES=false

macos:
flutter -dmacos run --debug --dart-define PLATFORM=macos --dart-define GIT_HASH=3bf5ef92abe6cb97f799801e1f4c387d63278cb6 --dart-define VERSION_TAG=v0.0.0 --dart-define ENABLE_GOOGLE_SERVICES=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants