Skip to content

Instantly share code, notes, and snippets.

@tjbcg
Last active February 19, 2026 14:21
Show Gist options
  • Select an option

  • Save tjbcg/9c058bee1b7cfedad6c724fd3e337851 to your computer and use it in GitHub Desktop.

Select an option

Save tjbcg/9c058bee1b7cfedad6c724fd3e337851 to your computer and use it in GitHub Desktop.
An almost self-contained bash script that builds sioyek from scratch on macOS
#!/usr/bin/env bash
export QT_VERSION=6.9.2
set -e
COLOR='\033[1;32m'
NC='\033[0m' # No Color
log() {
echo -e "${COLOR}#" $@ "${NC}"
}
WD=$(mktemp -d)
log "Working in: $WD"
cd $WD
log "Install dependencies"
brew install --quiet freeglut mesa harfbuzz
log "Cloning source code"
git clone --quiet -b development --recurse-submodules -j8 https://github.com/ahrm/sioyek.git .
TARGET=$(sw_vers -productVersion | cut -d. -f1)
log "macOS target: $TARGET"
log "Modifying build script to use new target"
sed -Ei '' "s/QMAKE_MACOSX_DEPLOYMENT_TARGET.=.[0-9]+/QMAKE_MACOSX_DEPLOYMENT_TARGET = $TARGET/" pdf_viewer_build_config.pro
log "Making python virtual environment in directory venv"
python3 -m venv venv
source venv/bin/activate
log "Installing aqtinstall"
pip install aqtinstall
log "Installing qt $QT_VERSION with all modules"
aqt install-qt mac desktop $QT_VERSION clang_64 -m all
log "Deactivating venv"
deactivate
log "Defining QT-related environment variables"
export Qt6_DIR=$PWD/$QT_VERSION/macos/
export QT_PLUGIN_PATH=$PWD/$QT_VERSION/macos/plugins
export PKG_CONFIG_PATH=$PWD/$QT_VERSION/macos/lib/pkgconfig
export QML2_IMPORT_PATH=$PWD/$QT_VERSION/macos/qml
export PATH="$PWD/$QT_VERSION/macos/bin:$PATH"
THREADS=$(sysctl -n hw.ncpu)
log "Starting the building process with $THREADS parallel threads"
env MAKE_PARALLEL=$THREADS ./build_mac.sh
log "Extracting build artifact into /tmp/sioyek.app"
mv build/sioyek.app /tmp/sioyek.app
log "Signing app package"
sudo codesign --force --sign - --deep /tmp/sioyek.app
log "Remove all source code and intermediary objects"
cd /tmp
rm -rf $WD
@keikun555
Copy link

keikun555 commented Feb 18, 2026

This fails on Tahoe due to ld: framework 'AGL' not found. Perhaps we want to use a newer qt version.
https://forum.qt.io/topic/163262/ld-framework-agl-not-found-on-macos-tahoe

...
ld: framework 'AGL' not found
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sioyek.app/Contents/MacOS/sioyek] Error 1

@tjbcg
Copy link
Author

tjbcg commented Feb 19, 2026

I'm testing with 6.9.2 and and looks like it's linking right. I'll update the script. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment