Getting Started
Using the Fyne toolkit to build cross platform applications is very simple but does require some tools to be installed before you can begin. If your computer is set up for development with Go then the following steps may not be required, but we advise reading the tips for your operating system just in case. If later steps in this tutorial fail then you should re-visit the prerequisites below.
Prerequisites
Fyne requires 3 basic elements to be present, the Go tools (at least version 1.12), a C compiler (to connect with system graphics drivers) and an system graphics driver. The instructions vary depending on your operating system, choose the appropriate tab below for installation instructions.
Note that these steps are just required for development - your Fyne applications will not require any setup or dependency installation for end users!
- Windows
- macOS X
- Linux
- Raspberry Pi
- BSD
- Android
- iOS
- Download Go from the download page and follow instructions
- Install one of the available C compilers for windows, the following are tested with Go and Fyne:
- MSYS2 with MingW-w64 - msys2.org
- TDM-GCC - tdm-gcc.tdragon.net
- Cygwin - cygwin.com
- In Windows your graphics driver will already be installed, but it is recommended to ensure they are up to date.
- Download Go from the download page and follow instructions
- Install Xcode from the Mac App Store
- Set up the Xcode command line tools by opening a Terminal window and typing the following:
xcode-select --install
- In macOS the graphics drivers will already be installed.
- You will need to install Go, gcc and the graphics library header files using your package manager, one of the following commands will probably work.
- Ubuntu / Debian:
sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev
- Fedora:
sudo dnf install golang gcc libXcursor-devel libXrandr-devel mesa-libGL-devel libXi-devel libXinerama-devel libXxf86vm-devel
- Solus:
sudo eopkg it -c system.devel golang mesalib-devel libxrandr-devel libxcursor-devel libxi-devel libxinerama-devel
- Arch Linux:
sudo pacman -S go xorg-server-devel
- Void Linux:
sudo xbps-install -S go base-devel xorg-server-devel libXrandr-devel libXcursor-devel libXinerama-devel
- You will need to install Go, gcc and the graphics library header files using the package manager.
sudo apt-get install golang gcc libegl1-mesa-dev xorg-dev
- You will need to install Go, gcc and the graphics library header files using the package manager.
- FreeBSD:
sudo pkg install go gcc xorg glfw pkgconf
- To develop apps for Android you will first need to install the tools for your current computer (Windows, macOS or Linux)
- Once complete you will need to install the Android SDK and Android NDK - the recommended approach is to install Android Studio and then go to Tools > SDK Manager and from SDK Tools install the NDK (Side by side) package.
- To develop apps for iOS you will need access to an Apple Mac computer, configured according to the macOS tab above.
- You will also need to create an Apple Developer account and sign up to the developer program (costs apply) to obtain the necessary certificate to run your app on any devices.
Downloading
After installing any prerequisites the following command will do everything to get Fyne installed:
$ go get fyne.io/fyne/v2
Once that command completes you will have the full Fyne development package installed in your GOPATH.
Run demo
If you want to see the Fyne toolkit in action before you start to code your own application then you can see our demo app running on your computer by executing:
$ go get fyne.io/fyne/v2/cmd/fyne_demo
$ fyne_demo
And that’s all there is to it! Now you can write your own Fyne application in your IDE of choice. If you want to see some Fyne code in action then you can read your first application. Alternatively you could check out our tour of the Fyne toolkit using the button below.