User gets error when running my app lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- MISV · 2021-02-15 17:14 QuoteUnable to create file "/Users/*username*/.config/MyApp/reg.xml": Permission denied. Press OK to ignore and risk data corruption. Press Abort to kill the program. But researching right now... ---------------------------------------------------------------------- MISV · 2021-02-15 17:41 Okay, so somehow this gives an error on the users system,. If it is a Lazarus error (and not MacOS error) maybe this will solve it: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     try    TmpOpen := TmpReg.OpenKey(FRegPath, True);    except      TmpOpen := False;    end;  I will try that and hear if that resolves the error. (My software can function without access to .config / registry) ---------------------------------------------------------------------- MISV · 2021-02-15 18:32 User used 11.2.1 (Never received this error before. Not sure if this maybe apply generally to Lazarus / Big Sur when using TRegistry) ---------------------------------------------------------------------- jwdietrich · 2021-02-15 19:52 One of the problems with your code is that it tries to store preferences in a hidden folder. According to Apple's guidelines, the settings of an application are to be stored in the Preferences folder. See https://wiki.lazarus.freepascal.org/Locating_macOS_app_support,_pr eferences_folders for a platform-sensitive method how to get the path to the correct folder. ---------------------------------------------------------------------- MISV · 2021-02-16 00:29 I believe this problem is caused by TRegistry Lazarus/LCL wrapper on Mac. https://wiki.freepascal.org/fcl-registry Quoteexample, under non-Windows operating systems it creates the per user XML file (HKEY_CURRENT_USER) reg.xml in the /home/[user]/.config/application_name/ directory More precisely in xregreg.inc in TRegistry.SysRegCreate > GetAppConfigDir ... Just submitted it: https://bugs.freepascal.org/view.php?id=38495 ---------------------------------------------------------------------- trev · 2021-02-16 01:02 The root cause is GetAppConfigDir - see also https://bugs.freepascal.org/view.php?id=20706 ---------------------------------------------------------------------- MISV · 2021-02-16 07:27 I wonder how to best work around this until a solution is found. Fix the source (but have it wiped next time an update is made) I would prefer to keep using the TRegistry since it is a kinda nice workaround enabling me to keep my code portable. Just asking in case I am missing an obvious solution ---------------------------------------------------------------------- trev · 2021-02-16 11:40 Use the Core Foundation CFPreferences functions which automatically take care of the preference file and its location. There is also the higher level Cocoa NSUserDefaults class, but it has had a checkered history of intermittent failures starting with iOS 9 and macOS 10.13 over several years of updates, so is best avoided. ---------------------------------------------------------------------- MISV · 2021-02-23 10:34 Creating (forcedirectories) the directories used by TRegistry seems to work. But I have added some extra checks now so even if everything fails program continues to work