Catalog · How the catalog works
macOS-SMJobBless-Lazarus-Pascal
How to create an privileged Helper Tool under macOS, with Lazarus Pascal, to get root acces in your application.
- ★ 6 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
macOS-SMJobBless-Lazarus-Pascal
How to create an privileged Helper Tool under macOS, with Lazarus Pascal, to get root acces in your application.
A full description and a ton of related information can be found on my homepage:
English: MacOS - SMJobBless: Elevated Privileges in Lazarus Pascal
Dutch: MacOS - SMJobBless: Elevated Privileges met Lazarus Pascal
SmJoBBless and Elevated Privileges Helper Tool Example
Purpose:
Simple example on how to create a Privileged Helper Tool using Lazarus Pascal, so your application can get root access by using such a Helper Tool.
Requirement:
A valid Apple Developer ID in order to sign the app bundle and the Helper Tool.
Tested and created with:
Lazarus 2.1.0 r60620M FPC 3.0.4 x86_64-darwin-cocoa (alpha) from SVN.
Before you start
I've uploaded a ZIP file that holds all files. Not the way GitHub should work, I know. Unfortunately, the project1.app structure seems to get lost when uploading empty directories, and we need those directories for things to work. I recommend downloading the zip file, and extracting that instead of cloning all files.
- Replace "XXXXXXXXXX" with your Developer ID in these files:
SMJobBlessTest/project1.app/Contents/Info.plist
SMJobBlessTest/Helper/SMJobBlessHelper-Info.plist- Replace "John Doe (XXXXXXXXXX)" with your Developer name and ID in this file:
SMJobBlessTest/prepareproject1.sh-
Open the Helper Tool project com.tweaking4all.SMJobBlessHelper.lpi in Lazarus and compile it with "Build".
-
Open the Main Application project project1.lpi in Lazarus and compile it with "Build".
-
in Terminal, go to the "SMJobBlessTest" directory and run "./prepareproject.sh"
Optionally verify with
./SMJobBlessUtil.py check project1.app- Open Console (Applications/Utilities) and set the filter to "SMJOBBLESS"
- Run project1.app (or project1) from the "SMJobBlessTest" directory.
- "Initialize" will initialze and optionally install the Helper Tool
- "Start Complicated" will start a process that keeps putting timestamps in the log
- "Is Active?" will show if it's active or not
- "Abort Complicated" will stop the time stamping
- "Last Error" will just show a dummy message
- "Get Version" will show the current Helper Version
- "Quit Helper" will terminate the Helper tool
Clean up:
Remove Helper Tool
(Caution: this may not be the appropriate method)
sudo rm /Library/PrivilegedHelperTools/com.tweaking4all.SMJobBlessHelperKill running Helper Tool
(Caution: this may not be the appropriate method)
ps -ax | grep com.tweaking4all
sudo kill -9 <PID>Where <PID> is the PID from the "ps" line that had "com.tweaking4all.SMJobBlessHelper" in it.

