trilium icon indicating copy to clipboard operation
trilium copied to clipboard

Support compiling native MacOS arm64 (Apple Silicon) builds

Open gigamonster256 opened this issue 9 months ago • 2 comments

Following along with the original request in #3125 and the followup plus community troubleshooting in #3302, I was able to successfully build a working native arm64 build of trilium for MacOS on my M1 mac as well using my Windows 11 wsl environment.

Using the native package rather than relying on the Rosetta translation layer leads to a much better startup time (a couple seconds at most vs 10-20 seconds before) and a much snappier experience. (as originally reported in #3302)

A user in #3302 voiced concerns about an arm64 native build being bigger than the x86-64 build, but their observations seem to come from using a different packaging system than trilium uses for its other builds. I replicated the current build flow for arm64 and the resulting binaries are comparable to the released build sizes. (See below)

Screenshot 2024-05-18 at 3 38 18 AM I built both the latest and second latest versions of trilium to test. The top row of applications was compiled by me (both intel and arm builds) and the bottom are from the trilium releases.

Concerning future maintainability, better-sqlite3 does not have prebuilt binaries for version 8.4.0 with electron 25 so I compiled that combination myself for macos arm64 and added it to the precompiled binaries used for trilium releases. If in future releases of trilium the version of electron and/or better-sqlite3 is changed, precompiled binaries will most likely be available through better-sqlite3 releases, removing the need for an Apple Silicon computer to keep arm64 builds up to date.

gigamonster256 avatar May 18 '24 09:05 gigamonster256