Skip to content

Building on macOS arm64

LAURENS Jérôme edited this page Apr 24, 2023 · 2 revisions

These instructions are for Macs running Apple Silicon processors (M1, M2...). Command lines are executed in a terminal running in normal arm64 mode (the command uname -m returns arm64)

TeXworks sources

If you want to contribute to the project, please visit the official repository, otherwise just download the code, expand the zip archive and move the source folder to the correct location.

macOS Ventura 13 (2023/03/16)

There are two exclusive possibilities, either with MacPorts or Homebrew: pick the one that works... Anyways, both need building tools:

Xcode

Install the official Apple developer tools. In the Mac AppStore, search Xcode.

CMake

You install CMake from [https://cmake.org/download/](the official repository). Make sure you download a universal archive.

Macports

export PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH"

You can also customize your .zshrc accordingly, but that may conflict with homebrew.

  • install the required libraries (it may take a while) with terminal command
sudo port install hunspell lua53 poppler-qt5 qt5-qtbase qt5-qtdeclarative qt5-qtscript qt5-qttools

lua53 is the latest version provided for arm64. It may take a while and you will have to press the enter key multiple times.

  • In the terminal, cd to the TeXworks source root directory and execute
mkdir build
cd build
cmake -DCMAKE_OSX_ARCHITECTURES="arm64"  -DQT_DEFAULT_MAJOR_VERSION=5 -DLUA_VERSION_STRING="53" .. 
make -j
make test
  • This creates TeXworks.app that you can move and launch. Remember that running two TeXworks concurrently may sometimes cause unexpected results.

Homebrew

  • Install homebrew with terminal command
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Open a terminal and execute command
export PATH="/opt/homebrew/bin:$PATH"

You can also customize your .zshrc accordingly, but that may conflict with macports.

  • install the required libraries (it may take a while) with terminal command
brew install hunspell poppler-qt5 lua qt@5
brew link --force poppler-qt5

There is no poppler-qt6.

  • In the terminal, cd to the TeXworks source root directory and execute
mkdir build
cd build
cmake -DQT_DEFAULT_MAJOR_VERSION=5 -DQt5_DIR=/opt/homebrew/Cellar/qt@5/5.15.8_2/lib/cmake/Qt5 -DCMAKE_PREFIX_PATH=/opt/homebrew -DCMAKE_OSX_ARCHITECTURES="arm64" ..
make -j
make test

Beware that Qt version is explicitly given. It may have changed.

  • This creates TeXworks.app that you can move and launch. Remember that running two TeXworks concurrently may sometimes cause unexpected results.

Problems

If you install anaconda, it can take precedence over Macports or homebrew. Whereas the build succeeds in appearance, the resulting application may be unbearably slow in some circumstances. To avoid this, you can run conda deactivate just before launching cmake and make.

If you plan to use an IDE, be sure to use an arm64 compliant configuration.