# Making desktop apps with crystal, cli or gui

**URL:** <https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955>\
**Category:** Help & Support\
**Created:** [June 23, 2024, 7:05am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955 "2024-06-23T07:05:30Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![patricus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@patricus](https://forum.crystal-lang.org/u/patricus)\
**Post date:** [June 23, 2024, 7:05am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/1 "2024-06-23T07:05:30Z")

</div>

hi.  
crystal is almost great for desktop app development, but just one issue.  
there’s no cross compilation unless you count the oldfashioned $100 per compilation on a CI/CD, which isn’t an option for free app development as a hobby.  
is it possible to make cross compilation actually good, and when someone will make it so?

---

<div class="post-metadata">

**Author:** ![zw963](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/zw963/32/1623_2.png) [@zw963](https://forum.crystal-lang.org/u/zw963)\
**Post date:** [June 23, 2024, 9:44am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/2 "2024-06-23T09:44:41Z")

</div>

> [@Use zig cc as a alternative linker (draft version)](https://forum.crystal-lang.org/t/use-zig-cc-as-a-alternative-linker-draft-version/6345):
>
> This approach was originally verified by @luislavena and first posted [here](https://forum.crystal-lang.org/t/a-github-action-template-for-do-release-assets-when-push-a-tag-it-should-fitable-for-any-shards/4635/5), [here](https://forum.crystal-lang.org/t/a-github-action-template-for-do-release-assets-when-push-a-tag-it-should-fitable-for-any-shards/4635/8) and [here](https://forum.crystal-lang.org/t/does-anyone-deploy-crystal-app-on-arm-based-linux-server-what-is-the-deployment-process-like/5588/5), big thanks to him for proving this solutin work, and he showed a little bit of this in following videos: [Building CLIs with Crystal - Quick cross-compilation - Part 1](https://www.youtube.com/watch?v=ij7alYEvfTg) [Building CLIs with Crystal - Quick cross-compilation - Part 2](https://www.youtube.com/watch?v=LdVNqdf\_kBI) Here are some links explain how zig cc link work: [zig cc: a Powerful Drop-In Replac…](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html)

---

<div class="post-metadata">

**Author:** ![patricus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@patricus](https://forum.crystal-lang.org/u/patricus)\
**Post date:** [June 24, 2024, 9:26am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/3 "2024-06-24T09:26:50Z")

</div>

so, could you give me the simple outline how to do it?

---

<div class="post-metadata">

**Author:** ![zw963](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/zw963/32/1623_2.png) [@zw963](https://forum.crystal-lang.org/u/zw963)\
**Post date:** [June 24, 2024, 10:10am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/4 "2024-06-24T10:10:11Z")

</div>

Are you checking the above post carefully?

---

<div class="post-metadata">

**Author:** ![patricus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@patricus](https://forum.crystal-lang.org/u/patricus)\
**Post date:** [June 24, 2024, 10:21am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/5 "2024-06-24T10:21:36Z")

</div>

yes but youtube videos don’t help me much because I’m blind.

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [June 24, 2024, 10:49am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/6 "2024-06-24T10:49:05Z")

</div>

Just yesterday the author of these videos published a written article about cross-compiliation: [Cross-compiling Crystal applications - Part 1](https://forum.crystal-lang.org/t/cross-compiling-crystal-applications-part-1/6956)

---

<div class="post-metadata">

**Author:** ![patricus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@patricus](https://forum.crystal-lang.org/u/patricus)\
**Post date:** [June 24, 2024, 11:12am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/7 "2024-06-24T11:12:23Z")

</div>

just an image, I can’t read anything from an image, my screenreader doesn’t work with them unless someone labels them.

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [June 24, 2024, 1:14pm UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/8 "2024-06-24T13:14:38Z")

</div>

What image?

---

<div class="post-metadata">

**Author:** ![tsornson](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/tsornson/32/1651_2.png) [@tsornson](https://forum.crystal-lang.org/u/tsornson)\
**Post date:** [June 24, 2024, 1:27pm UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/9 "2024-06-24T13:27:51Z")

</div>

I also don’t see an image anywhere, maybe a popup? Here’s a direct link to the blog post that appears to be all text: [Cross-compiling Crystal applications - Part 1](https://luislavena.info/writing/cross-compiling-crystal-applications-part-1/)

Hope it helps :)

---

<div class="post-metadata">

**Author:** ![patricus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@patricus](https://forum.crystal-lang.org/u/patricus)\
**Post date:** [June 24, 2024, 3:37pm UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/10 "2024-06-24T15:37:15Z")

</div>

ok, but that’s just some technical info not actual like, how do I do this without going weird with writing my own compiler and stuff.

---

<div class="post-metadata">

**Author:** ![ralsina](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/ralsina/32/2139_2.png) [@ralsina](https://forum.crystal-lang.org/u/ralsina)\
**Post date:** [June 24, 2024, 3:47pm UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/11 "2024-06-24T15:47:55Z")

</div>

Maybe this will work for you?

> [@Cross-compiling using qemu-static](https://forum.crystal-lang.org/t/cross-compiling-using-qemu-static/6961):
>
> qemu-static allows you to run containers built for other architectures (of course, with a performance penalty). BUT this means you can cross-compile to arm/amd64 quite easily. Here’s an example: $ docker run --rm --privileged \ multiarch/qemu-user-static \ --reset -p yes $ uname -a Linux mindy 6.9.3-arch1-1 #1 SMP PREEMPT\_DYNAMIC Fri, 31 May 2024 15:14:45 +0000 x86\_64 GNU/Linux $ cat Dockerfile FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine AS base RUN apk add crysta…

---

<div class="post-metadata">

**Author:** ![zw963](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/zw963/32/1623_2.png) [@zw963](https://forum.crystal-lang.org/u/zw963)\
**Post date:** [July 8, 2024, 10:12am UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/12 "2024-07-08T10:12:54Z")

</div>

> <https://github.com/zw963/crystal-book/blob/patch-1/docs/guides/use_zig_cc_as_an_alternative_linker.md>

Not native language writer, and please ignore the bad English, but i thought this post have everything you need.

---

<div class="post-metadata">

**Author:** ![kojix2](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/kojix2/32/1583_2.png) [@kojix2](https://forum.crystal-lang.org/u/kojix2)\
**Post date:** [July 8, 2024, 1:22pm UTC](https://forum.crystal-lang.org/t/making-desktop-apps-with-crystal-cli-or-gui/6955/13 "2024-07-08T13:22:28Z")

</div>

I am not a professional programmer, but here is how I create command-line tools in Crystal:

1. Make it open-source. This way, GitHub Actions can be used for free, so there is no need to pay for CI. These actions will automatically run and upload releases when a version tag is added.
2. For Linux, use the [official Docker image to create statically linked binaries](https://crystal-lang.org/reference/1.12/guides/static_linking.html#musl-libc).
3. For Mac, do not create statically linked binaries because [the method is not yet established](https://crystal-lang.org/reference/1.12/guides/static_linking.html#macos). Instead, provide a [homebrew tap](https://github.com/kojix2/homebrew-brew) so users can install it using the brew command.
4. For Windows, if the project is purely written in Crystal, you can create statically linked binaries by using the --static option. It is difficult to [call C libraries on Windows](https://forum.crystal-lang.org/t/how-to-create-a-gui-app-using-libui-ng-on-windows/6361).

For the GUI, there are not many good options. But if you only need to support Linux and Mac, I think [gtk4](https://github.com/hugopl/gtk4.cr) is the best choice. If you want to support Windows, there are no best practices, so you will have to write your own code and run around.
