Forum > macOS / Mac OS X

Lazarus Apps and Mac Accessibility


This is a question about running Lazarus Apps on MacOs. Using LazMouseAndKeyInput KeyPress function invokes the Mac Accessibility features thus needs permission.

I am experimenting with LazMouseAndKeyInput.  I started with the example in the Lazarus Install folder /lazarus/components/example.  Great, it works! Then I created my own program and after the first compile it too worked ( I granted permission when prompted by the OS).  Then after the second compile it did not.  Program runs but there is no key input.

So far I have discovered that the keypress function is being suppressed by the Security & Privacy Accessibility function.  On first run a message is popped up asking for permission to be granted.  But after it is granted subsequent runs within Lazarus also fail to provide key input.  Yet additional project1's are added to the accessibility panel but there is no way of telling what or where those project1's are located nor which project they belong to.

I think that each compile generates some kind of signature that is recognised by the OS as different thus not permitted.  This is a giant pain for developing in Lazarus.

I wonder if any MacOs developers can provide any insight into how to control this behaviour.  Maybe a way to disable MacOs for asking for Accessibility permission?

While I have not encountered your particular issue when recompiling programs, it may be related to this issue in which case first delete the old program before recompiling which you should be able to do in Project Options > Compiler Options > Compiler Commands - "execute before" command (it needs to be an executable file, so a simple Bourne shell script with appropriate permissions should work).

Thank you for your insight. I’ll check out your suggestion.


[0] Message Index

Go to full version