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
- The Xcode Command Line Tools:
xcode-select --install(Free Pascal needs the Apple linker). - Lazarus with Free Pascal 3.2.2 (tested with Lazarus 4.8), or the toolchain the script
build/macos/setup-toolchain.shinstalls, see below. - At run time, to measure and shape the text: FreeType, fontconfig and HarfBuzz. With
Homebrew:
or without Homebrew,brew install fontconfig harfbuzzbuild/macos/build-deps.shbuilds them from their sources in your user folder (nosudo) and links them in~/lib. ICU is the one of macOS. - For HTTPS (the AI assistants and the Reportman DB Agent driver): OpenSSL 3,
brew install openssl@3. The OpenSSL 0.9.8 that macOS keeps for compatibility is never used: it cannot verify certificates. An application can shiplibssl.3.dylibandlibcrypto.3.dylibinContents/Frameworksof its bundle instead.
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):
- An application could stop when a window with scroll bars is closed right after its layout changes. That happens with the classic scroll bars of a mouse; a trackpad uses overlay scroll bars.
- Every row of a list box lost a little memory.
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):
- FireDAC connections, opened with SQLdb: PostgreSQL, MySQL or MariaDB, Firebird, SQLite and ODBC. Free Pascal has no SQL Server connector for macOS: use ODBC with the FreeTDS ODBC driver.
- Zeos connections, with the same databases.
- The Reportman DB Agent driver (through the Hub) needs OpenSSL 3, see the requirements.
The client library of each database is looked for in this order:
- The one of the connection:
VendorLib(FireDAC connections) orLibraryLocation(Zeos), with the full path of the.dylib. - The library search of macOS (
~/lib,/usr/local/lib). - The folders of the usual installers:
| Database | Client library found in |
|---|---|
| PostgreSQL | Homebrew (libpq, postgresql@N), Postgres.app,
the EnterpriseDB installer (/Library/PostgreSQL/N), MacPorts |
| MySQL | the MySQL package (/usr/local/mysql), Homebrew
(mysql-client, mysql), MacPorts |
| MariaDB | Homebrew (mariadb-connector-c) |
| Firebird | the Firebird package
(/Library/Frameworks/Firebird.framework) |
| ODBC | unixODBC of Homebrew or MacPorts, and the iODBC of macOS |
| SQLite | the 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 SQL editor of the designer is the native editor with schema completion and the AI inline suggestion, as on Linux (the Monaco editor is Windows only).
- Not tested yet: Apple Silicon (arm64; the Free Pascal disk image includes its compiler) and printing.
- The installation package is signed ad hoc and not notarized (see Installation package), for Intel Macs only.
The technical notes of the port are in docs/macos.md of the source code.