-
Notifications
You must be signed in to change notification settings - Fork 81
Installing on OSX
The are two ways to install gotk3 on OSX. Users who prefer a more UNIX like system can install the first way and produce X11 apps. Users who prefer Mac native apps can install using the second method and build Mac native (quartz) apps.
In either case, you must have a recent version (1.1 or later) of go installed and setup properly.
When building to use X11, you must have the X11 version of gtk installed. The simplest way is to use a package manager such as MacPorts. Using MacPorts, one can install gtk3 with the command:
sudo port install gtk3
That should install all the required dependencies. You can then simply install gotk3 in the usual go way:
go get github.com/conformal/gotk3/gtk
Building native Mac apps requires a few more steps. The Gnome project provides a tool, jhbuild, which simplifies this somewhat although there are still a few steps needed. It is very important that you do not have macports, fink, homebrew, or any other package manager (or its pacakges) in your path while building gtk+ for the mac. Once you have built and installed it, you can have them in your path again without a problem while building things and using gotk3. In the case of MacPorts, I commented out the line:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
from my .profile an then logged out and back in before building. Once finished building gtk, I put the line back in to allow me to work normally.
Download the build script from gnome.org:
curl https://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh \ -o gtk-osx-build-setup.sh
Run the script:
sh gtk-osx-build-setup.sh
Assuming you are using bash (the default in OSX), you can set this alias to help use jhbuild
alias jhbuild="PATH=$HOME/gtk/bin:$PATH ~/.local/bin/jhbuild"
Install gtk+3 and all the required dependencies:
jhbuild bootstrap jhbuild build meta-gtk-osx-bootstrap jhbuild build meta-gtk-osx-core jhbuild build meta-gtk-osx-gtk3
jhbuild can temporarily setup the environment for your shell to make sure all the paths are correct. You will only need this when you initially build the gotk3 library.
jhbuild shell go get github.com/conformal/gotk3/gtk exit
You can now go back to your normal environment. It might be a good idea to build some of the samples provided to make sure everything works and to get some idea of what you can do:
cd $GOPATH/src/github.com/conformal/gotk3/gtk/examples/simple go build ./simple