Tribler development environment setup on MacOS (10.10 to latest).

HomeBrew

This guide will outline how to setup a Tribler development environment on Mac.

PyQt5

If you wish to run the Tribler Graphical User Interface, PyQt5 should be available on the system. To install PyQt5, we first need to install Qt5, a C++ library which can be installed with Brew:

brew install python3 qt5 sip pyqt5
brew cask install qt-creator # if you want the visual designer
brew link qt5 --force # to allow access qmake from the terminal

qmake --version # test whether qt is installed correctly

Libtorrent

You can install libtorrent with Brew using the following command:

brew install libtorrent-rasterbar

To verify a correct installation, you can execute:

python3
>>> import libtorrent

Symbol not found: _kSCCompAnyRegex error

If you see Symbol not found: _kSCCompAnyRegex error, then follow https://github.com/Homebrew/homebrew-core/pull/43858 for the explanation.

You can build libtorrent by yourself: http://libtorrent.org/python_binding.html or by using this workaround from PR:

  1. Edit brew formula:

brew edit libtorrent-rasterbar
  1. Add on the top of the install function ENV.append string as described below:

def install
    ENV.append "LDFLAGS", "-framework SystemConfiguration -framework CoreFoundation"
  1. Build libtorrent-rasterbar from source:

brew install libtorrent-rasterbar --build-from-source

Other Packages

There are a bunch of other packages that can easily be installed using pip and brew:

brew install gmp mpfr libmpc libsodium
cd src && python3 -m pip install -r requirements.txt

To enable Bitcoin wallet management (optional), you should install the bitcoinlib library (support for this wallet is experimental):

python3 -m pip install bitcoinlib==0.4.10

Tribler

The security system on MacOS can prevent libsodium.dylib from being dynamically linked into Tribler when running Python. If this library cannot be loaded, it gives an error that libsodium could not be found. This is because the DYLD_LIBRARY_PATH cannot be set when Python starts. More information about this can be read here.

The best solution to this problem is to link or copy libsodium.dylib into the Tribler root directory.

git clone --recursive  https://github.com/Tribler/tribler.git
cd tribler
cp /usr/local/lib/libsodium.dylib ./ || cp /opt/local/lib/libsodium.dylib ./

You can now run Tribler by executing the following bash script in the src directory:

./tribler.sh

Proceed proceed to Build instructions

Help

If there are any problems with the guide above, please feel free to fix any errors or create an issue so we can look into it.