Go bindings for IUP, a multi-platform toolkit for building graphical user interfaces. The toolkit provides system native UI controls for Windows (Win32), macOS (Cocoa) and Linux (GTK and Qt).
IUP C source code is included and compiled together with bindings. Note that the first build can take a few minutes.
On Windows, you need a C compiler, like Mingw-w64 or TDM-GCC. You can also build a binary in MSYS2 shell.
- To remove a console window, i.e., compile GUI app with WinMain entry-point, build with
-ldflags "-H=windowsgui". - You can add icon resource to
.exefile with the rsrc tool. - Windows manifest is included in the build by default. See below how to disable manifest if you want to include your own.
On macOS, you need Command Line Tools for Xcode (if you have brew, you already have this).
- To create an
.appbundle or.dmgimage check this gist https://gist.github.com/mholt/11008646c95d787c30806d3f24b2c844. - You can build for Qt in macOS, with
qtbuild tag. Install deps withbrew install qt. - You can build for GTK in macOS, with
gtkbuild tag. Install deps withbrew install gtk+3.
On Linux, you need a C compiler and development packages for GTK or Qt.
- Debian/Ubuntu:
apt-get install libgtk-3-dev - RedHat/Fedora:
dnf install gtk3-devel
Note that you can also build for GTK2.
You do not need to install WebKitGTK development packages for WebBrowser control, libraries are loaded on runtime.
- Debian/Ubuntu:
apt-get install qt6-base-dev - RedHat/Fedora:
dnf install qt6-qtbase-devel
Note that you can also build for Qt5.
For WebBrowser control, install qt6-webengine-dev or qt6-qtwebengine-devel.
The library should work on other Unix-like systems, FreeBSD, NetBSD, OpenBSD, DragonFly, Solaris, Illumos, and AIX.
You can also compile for a time-tested Motif library if GTK or Qt are not available.
- Debian/Ubuntu:
apt-get install libmotif-dev libxmu-dev libxpm-dev - RedHat/Fedora:
dnf install motif-devel libXpm-devel
gl- build with support forGLCanvascontrolweb- build with support forWebBrowsercontrolgtk- use GTK in macOS or Windowsgtk2- build for GTK2 version, default is GTK3qt- build for Qt frameworkqt5- build for Qt5 version, default is Qt6 (used withqt)motif- build for X11/Motif 2.x environmentxembed- use XEmbed tray protocol instead of SNInomanifest- do not include manifest in Windows buildnopkgconfig- do not use pkg-config for compile and link flags
You can provide explicit compiler and linker flags instead of using the defaults provided by pkg-config. For example, if dependencies are in a non-standard location:
CGO_CFLAGS="-I<include path> ..." CGO_LDFLAGS="-L<dir> -llib ..." go build -tags nopkconfig
You can also point PKG_CONFIG_LIBDIR to some local directory with custom modified .pc files.
IUP documentation is a must, every Go function in doc reference there. Also check Go Reference and Examples.
User interface (and OpenGL) is usually not thread-safe and IUP is not thread-safe. Some platforms enforce running UI on the main thread. Note that a goroutine can arbitrarily and randomly be scheduled or rescheduled on different running threads.
The secondary threads (goroutine) should not directly update the UI, instead, use PostMessage that is expected to be thread-safe.
See example that sends data to an element,
that will be received by a callback when the main loop regains control. You can also use the IdleFunc and Timer.
To cross-compile for Windows, install MinGW toolchain.
$ CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -ldflags "-s -w"
$ file alarm.exe
alarm.exe: PE32+ executable (console) x86-64, for MS Windows
$ CGO_ENABLED=1 CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -ldflags "-s -w"
$ file alarm.exe
alarm.exe: PE32 executable (console) Intel 80386, for MS Windows
To cross-compile for macOS, install OSXCross toolchain. Ready-made SDK tarballs are available here.
$ CGO_ENABLED=1 CC=x86_64-apple-darwin25-clang GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w"
$ file alarm
alarm: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK>
$ CGO_ENABLED=1 CC=aarch64-apple-darwin25-clang GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w"
$ file alarm
alarm: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|PIE>
See more screenshots.
iup-go is MIT licensed, same as IUP. View LICENSE.




