Skip to content

Installation on macOS

therecipe edited this page Nov 18, 2019 · 34 revisions

Fast track version

If you want to install Go
GO=go1.13.4.darwin-amd64.pkg; curl -sL https://dl.google.com/go/$GO -o $HOME/Downloads/$GO && sudo installer -pkg $HOME/Downloads/$GO -target / && rm $HOME/Downloads/$GO
If you want to install the binding
In GOPATH (global installation) mode
export GO111MODULE=off; xcode-select --install; go get -v github.com/therecipe/qt/cmd/... && $(go env GOPATH)/bin/qtsetup test && $(go env GOPATH)/bin/qtsetup -test=false
In Module (per project) mode (to work around the GFW you can use a proxy like this: GOPROXY=https://goproxy.io)
export GO111MODULE=on; xcode-select --install; go get -v github.com/therecipe/qt && go install -v -tags=no_env github.com/therecipe/qt/cmd/... && go mod vendor && git clone https://github.com/therecipe/env_darwin_amd64_513.git vendor/github.com/therecipe/env_darwin_amd64_513 && $(go env GOPATH)/bin/qtsetup
If you just want to compile an application
In GOPATH (global installation) mode

(replace github.com/therecipe/examples/... with the project you want to compile)

export GO111MODULE=off; xcode-select --install; go get -v github.com/therecipe/qt/cmd/... && $(go env GOPATH)/bin/qtdeploy test desktop github.com/therecipe/examples/basic/widgets
In Module (per project) mode (to work around the GFW you can use a proxy like this: GOPROXY=https://goproxy.io)
export GO111MODULE=on; xcode-select --install; git clone https://github.com/therecipe/examples.git && cd ./examples && go install -v -tags=no_env github.com/therecipe/qt/cmd/... && go mod vendor && git clone https://github.com/therecipe/env_darwin_amd64_513.git vendor/github.com/therecipe/env_darwin_amd64_513 && $(go env GOPATH)/bin/qtdeploy test desktop ./basic/widgets

Official version (with iOS/Android support)


HomeBrew version (without iOS/Android support)


MacPorts version (without iOS/Android support)

  • Install Xcode and the Command Line Tools: https://itunes.apple.com/us/app/xcode/id497799835 and then xcode-select --install

  • Install MacPorts and export QT_MACPORTS=true

  • Install Qt

    sudo port -b install qt5 qt5-qtcharts qt5-qtdatavis3d qt5-qtpurchasing qt5-qtremoteobjects qt5-qtscript qt5-qtwebglplugin qt5-qtwebengine qt5-qtwebview
    • optional: install the experimental webkit module: sudo port -b install qt5-qtwebkit and export QT_WEBKIT=true
  • Install Go: https://golang.org/doc/install?download=go1.13.4.darwin-amd64.pkg

  • Clone the repo: go get -v -tags=no_env github.com/therecipe/qt/cmd/...

  • Run the setup: $(go env GOPATH)/bin/qtsetup


Nix version (without iOS/Android support)

  • Install Xcode and the Command Line Tools: https://itunes.apple.com/us/app/xcode/id497799835 and then xcode-select --install

  • Install Nix

  • Install Qt

    nix-env -b -i go qtbase qtcharts qtdeclarative qtdoc qtgraphicaleffects qtimageformats qtlocation qtmacextras qtmultimedia qtquickcontrols qtquickcontrols2 qtscript qtsensors qtserialport qtspeech qtsvg qttools qttranslations qtvirtualkeyboard qtwebchannel qtwebengine qtwebsockets qtx11extras qtxmlpatterns
    • optional: install the experimental webkit module: nix-env -i qtwebkit
  • Install Go: https://golang.org/doc/install?download=go1.13.4.darwin-amd64.pkg

  • Clone the repo: go get -v -tags=no_env github.com/therecipe/qt/cmd/...

  • Run the setup: $(go env GOPATH)/bin/qtsetup


Now that you are done with the installation you can start reading the usage instructions and build the examples.

Clone this wiki locally