Report Manager ← Back to site

Report Manager on macOS (Lazarus, Cocoa)

The Lazarus packages of Report Manager (engine with PDF export, LCL preview and printing, and the embeddable designer), their examples and the Report Manager Designer build on macOS with Lazarus and the native Cocoa widgetset. They use the same .rep report files as Windows and Linux.

Tested on macOS 11 Big Sur (Intel, x86_64) with Lazarus 4.8 and Free Pascal 3.2.2: the designer test suite, the preview against the PDF output, the examples and the database drivers against real PostgreSQL, MySQL, Firebird and SQLite servers.

Download: the Report Manager Designer for Intel Macs with macOS 10.15 or later is in the macOS folder of the release on SourceForge (reportman-designer-<version>-macos-x86_64.dmg, see Installation package). It can also be built from the source code as shown below.

Requirements

Applications started from the Finder do not receive DYLD_LIBRARY_PATH. The engine looks for each library in Contents/Frameworks of the application, next to the executable, in ~/lib, /usr/local/lib and the Homebrew and MacPorts folders.

The Lazarus packages

Install them as on the other platforms, from the source code (GitHub, SourceForge) or from the Online Package Manager (the changes for macOS are in the source code and reach the Online Package Manager with its next update). From a terminal, in the folder of the source code:

LAZBUILD=lazbuild sh packages/fpc/build_fpc.sh

Examples

The three examples of examples/lazarus (see Lazarus examples) build and run on macOS:

lazbuild examples/lazarus/pdfconsole/pdfconsole.lpi
lazbuild examples/lazarus/preview/preview.lpi
lazbuild examples/lazarus/designer/designer.lpi
examples/lazarus/pdfconsole/pdfconsole      # writes sales.pdf
open examples/lazarus/preview/preview.app
open examples/lazarus/designer/designer.app

Lazarus writes the LCL examples as application bundles (preview.app, designer.app) next to their projects: open them from the Finder or with open.

Example with a database: PostgreSQL

examples/lazarus/postgresql has two reports that open their own connection and SQL query on a sample database, one with each direct driver: sales_sqldb.rep (a FireDAC connection, opened with SQLdb) and sales_zeos.rep (Zeos). The console program pgreport writes both as PDF. With PostgreSQL from Homebrew:

brew install postgresql@16
brew services start postgresql@16
export PATH="$(brew --prefix postgresql@16)/bin:$PATH"   # psql
cd examples/lazarus/postgresql
./createdb.sh              # user and database rpsample, with the sample data
lazbuild pgreport.lpi
./pgreport                 # sales_sqldb.pdf and sales_zeos.pdf

With Postgres.app, put /Applications/Postgres.app/Contents/Versions/latest/bin in the PATH instead. The connections are in dbxconnections.ini of the folder; to open the reports in the designer, copy its two sections to the connections file of the designer: ~/.borland/dbxconnections when that file exists, otherwise ~/.dbxconnections in your home folder (the designer creates it).

Build the Report Manager Designer

Two scripts of the source code prepare everything in your user folder (~/dev), without sudo and without touching /usr/local:

build/macos/setup-toolchain.sh     # Free Pascal 3.2.2, Lazarus 4.8 and ZeosDBO in ~/dev
build/macos/build-deps.sh          # FreeType, HarfBuzz and fontconfig
. ~/dev/env.sh                     # lazbuild and fpc in the PATH
LAZBUILD=lazbuild sh packages/fpc/build_fpc.sh
build/macos/build-designer.sh      # repman/repmandesigner_lcl.app
open repman/repmandesigner_lcl.app

The designer uses the language of macOS (System Preferences > Language & Region), also when it is opened from the Finder, which gives applications no LANG variable. build-designer.sh adds the Lazarus translations of the standard dialogs and buttons to the bundle.

setup-toolchain.sh uses the official Free Pascal disk image without installing it and the official Lazarus 4.8 archive. It also applies two corrections to the Cocoa widgetset of Lazarus (build/macos/patches):

Apply them to your own Lazarus as well: patch -d <lazarus folder> -p1 < build/macos/patches/<file>.patch, then rebuild the IDE or your project.

Installation package

build-designer.sh makes an application for the machine that builds it (the bundle links the executable and the libraries of ~/dev). To install the designer on other Macs, build/macos/make-package.sh builds a self-contained application and its disk image:

build/macos/make-package.sh
# build/macos/out/<version>/Report Manager Designer.app
# build/macos/out/<version>/reportman-designer-<version>-macos-x86_64.dmg

The application carries FreeType, HarfBuzz and fontconfig with its configuration, the translations and the samples (sample4.rep and its data among them): open the disk image, drag the application to Applications and open it. It requires macOS 10.15 or later (the minimum of its libraries, declared in its Info.plist; tested on macOS 11). The .rep files open with the designer from the Finder: double click, drop them on its icon or Open With. The samples are inside the application; to change one, save it in another folder. The package does not include OpenSSL 3 (HTTPS for the AI assistants and the Reportman DB Agent driver: brew install openssl@3) nor the client libraries of the database servers.

The application is signed ad hoc, without an Apple Developer ID certificate nor notarization: the first time, macOS only opens it from the Finder with right click > Open.

Databases

Both direct database drivers of the engine work on macOS (see the PostgreSQL example):

The client library of each database is looked for in this order:

  1. The one of the connection: VendorLib (FireDAC connections) or LibraryLocation (Zeos), with the full path of the .dylib.
  2. The library search of macOS (~/lib, /usr/local/lib).
  3. The folders of the usual installers:
DatabaseClient library found in
PostgreSQLHomebrew (libpq, postgresql@N), Postgres.app, the EnterpriseDB installer (/Library/PostgreSQL/N), MacPorts
MySQLthe MySQL package (/usr/local/mysql), Homebrew (mysql-client, mysql), MacPorts
MariaDBHomebrew (mariadb-connector-c)
Firebirdthe Firebird package (/Library/Frameworks/Firebird.framework)
ODBCunixODBC of Homebrew or MacPorts, and the iODBC of macOS
SQLitethe one of macOS

Do not put the lib folder of a database server in DYLD_LIBRARY_PATH: those folders carry their own libiconv, libssl and others, which hide the ones of macOS and break other libraries.

Differences and limitations

The technical notes of the port are in docs/macos.md of the source code.