Skip to content

Instantly share code, notes, and snippets.

@7468696e6b
Last active November 29, 2025 20:33
Show Gist options
  • Select an option

  • Save 7468696e6b/ec8fa5d6cdb4e80633b9df95869b70c0 to your computer and use it in GitHub Desktop.

Select an option

Save 7468696e6b/ec8fa5d6cdb4e80633b9df95869b70c0 to your computer and use it in GitHub Desktop.
how to install Okular viewer on macOS Big Sur, using M1/Apple Silicon/arm64
  1. Install homebrew from https://brew.sh/ (follow the instructions there)
  2. tap the https://invent.kde.org/packaging/homebrew-kde/ repo, brew tap kde-mac/kde https://invent.kde.org/packaging/homebrew-kde.git
  3. brew edit okular, workaround now is to comment out or delete the line depends_on "chmlib" (won't compile on macos arm64 for now as of 2021-08-18), then save (if using vim you need to first press i to insert/type, when saving then <esc> then :wq then <enter>.
  4. brew install okular, wait for stuff to compile and/or install
  5. It may ask for keychain credentials (to sign the binaries? because of mac arm64 security policy https://eclecticlight.co/2021/01/26/when-you-dont-have-permission-to-run-an-app-on-an-m1-mac/)
  6. $(brew --repo kde-mac/kde)/tools/do-caveats.sh
  7. Now okular is in your $HOME/Applications/KDE folder, and will show up in Launchpad! You can view pdf, djvu, etc documents.

Edit: as of 2025 there is now a precompiled nightly binary available for download at https://okular.kde.org/download/, or at https://cdn.kde.org/ci-builds/graphics/okular/master/macos-arm64/. It is unsigned so use sudo xattr -rd com.apple.quarantine /Applications/okular.app to bypass quarantine after install.

@makotosakuraijp
Copy link

makotosakuraijp commented Nov 3, 2025

Hi David. The Okular Nightly Build doesn't support the print option for me.

I tried to build from the source of git to solve the problem of print / print-preview. I managed to change the CMaleList.txt to detect the LibSpectre package since this is the reason why we cannot use ps files. After ./configure, make, sudo make install, I changed some of the files and environment variables like this:

source ~/CraftRoot/craft/craftenv.sh

install_name_tool -change \ "/usr/local/lib/libspectre.1.dylib" \ "/Users/sakuraim/CraftRoot/lib/libspectre.1.dylib" \ /Users/sakuraim/myokular/lib/okular/generators/okularGenerator_ghostview.so

source /Users/sakuraim/okular/build/prefix.sh

export DYLD_LIBRARY_PATH="/Users/sakuraim/CraftRoot/lib:$DYLD_LIBRARY_PATH"
export OKULAR_GHOSTVIEW_DPI=1200
export QT_PLUGIN_PATH="/Users/sakuraim/CraftRoot/plugins"

Note that I changed CMakeList.txt as follows

# Apple-specific configuration
set(APPLE_SUPPRESS_X11_WARNING ON)

find_path(LIBSPECTRE_INCLUDE_DIR spectre/spectre.h
/opt/homebrew/include
/usr/local/include
)
find_library(LIBSPECTRE_LIBRARY spectre
/opt/homebrew/lib
/usr/local/lib
)

if(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
set(LibSpectre_FOUND TRUE CACHE BOOL "Found LibSpectre" FORCE)
set(LibSpectre_INCLUDE_DIRS ${LIBSPECTRE_INCLUDE_DIR} CACHE STRING "LibSpectre include dirs" FORCE)
set(LibSpectre_LIBRARIES ${LIBSPECTRE_LIBRARY} CACHE STRING "LibSpectre libraries" FORCE)
message(STATUS "Manually found LibSpectre: ${LIBSPECTRE_LIBRARY}")
endif()

The Kf6/Qt6 environment was introduced via the Craft packager. The build option was

cmake -DCMAKE_INSTALL_PREFIX=/Users/sakuraim/myokular \
-DCMAKE_PREFIX_PATH="/Users/sakuraim/myokular;/usr/local/lib;/usr/local;/Users/sakuraim/CraftRoot" \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DOKULAR_UI=desktop \
-DFORCE_NOT_REQUIRED_DEPENDENCIES="KExiv2Qt6;EPub;Discount" -Wno-dev ..

Now that I can open PS files and do print-preview. However, the preview / PS file size is very small. In addition, I still cannot print files. It crashed like this:

bus error ./okular

I tried to solve this problem, but so far it is not possible.

@DavidInRacine
Copy link

Did you try running the .dmg executable I linked above?

@makotosakuraijp
Copy link

I once tried to download your file, but it is expired now.

@makotosakuraijp
Copy link

I meant I tried running the .dmg file of another version, but I coult not print.

@DavidInRacine
Copy link

I once tried to download your file, but it is expired now.

I am happy to help another Mac user if you contact me via Github mail. It's FOSS software, so the .dmg file belongs to you as much as to me.

By any chance did you try using a CUPS print driver? That might be another theoretical path to success.

@DavidInRacine
Copy link

I meant I tried running the .dmg file of another version, but I coult not print.

Sadly, Okular does not appear to offer an in-app update option. We may be stuck with Version 25.11.70 until a newer .pdf gets uploaded somewhere.

I seldom use Okular, so it's not something I invest much time or effort in, but I like the consistency of a cross-platform FOSS app when I need it.

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