Building Telephant on macOS

May 13, 2019    Article    186 words    1 min read

Telephant is a lightweight but modern Mastodon client, written in Go & QML. GitHub

Telephant screenshot

I am making the assumption you have Homebrew already installed on a fairly-recent macOS version (read Mojave). If not, update your mac and install Homebrew.

First of all, install Go, Qt5 and pkg-config via Homebrew, if you don’t have the packages already installed. Also make sure Apple Xcode is installed.

$ brew install go qt5 pkg-config

Export a bunch of environment variables so the system will know where to find the paths.

$ export GOPATH="${HOME}/.go"
$ export GOROOT="$(brew --prefix golang)/libexec"
$ export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
$ export QT_PKG_CONFIG=true
$ export LDFLAGS="-L/usr/local/opt/qt/lib"
$ export CPPFLAGS="-I/usr/local/opt/qt/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig/""

Install Qt5 bindings for Go.

$ go get -u -v github.com/therecipe/qt/cmd/...

Generate the code and install all of Qt packages, which in turn will speed up the compilation of your application later.

$ $(go env GOPATH)/bin/qtsetup -test=false

Build Telephant.

$ go get -d -u -v github.com/muesli/telephant
$ cd $(go env GOPATH)/src/github.com/muesli/telephant
$ $(go env GOPATH)/bin/qtdeploy build desktop .

After it’s done compiling, open the .app bundle and enjoy.

$ open $(go env GOPATH)/src/github.com/muesli/telephant/deploy/darwin/telephant.app

Looking great so far!