Lazarus Release 2.2.0 and macOS aarch64 lazarus / 15-macOS - Mac OS X ---------------------------------------------------------------------- trev · 2022-01-06 07:01 macOS 12.1 - aarch64 - attempt to rebuild the IDE from within itself fails with: QuoteBuild IDE: Exit code 2, Errors: 2 Error: mkdir: ../units/aarch64-darwin/cocoa: Permission denied make[1]: *** [../units/aarch64-darwin/cocoa] Error 1 Error: make: *** [idepkg] Error 2 Directory permissions as installed: Quotedrwxr-xr-x  3     503  admin  96       2 Jan 21:20 units drwxr-xr-x  4     503  admin  128     2 Jan 21:22 x86_64-darwin drwxr-xr-x  896 503  admin  28672  2 Jan 21:24 cocoa I checked my stable of Mac minis and my user always has an id of 501. In comparison, my Firefox installation is owned by trev:admin The workaround: Quotecd /Applications sudo chown -R your_username Lazarus Then I was met with: Quotemake[2]: *** [lazarus] Error 1 make[1]: *** [idepkg] Error 2 Error: make: *** [idepkg] Error 2 Error: resource compiler "fpcres" not found, switching to external mode The fix for this is to create a .fpc.cfg (note the initial dot) file in your home directory and add these lines to it: Quote#include /etc/fpc.cfg -FD/usr/local/bin so that fpcres can be found where it was installed. The next hurdle: Quotemake[2]: *** [lazarus] Error 1 make[1]: *** [idepkg] Error 2 Error: make: *** [idepkg] Error 2 Error: Unsupported target architecture -Paarch64, invoke the "fpc" compiler driver instead. which is a little weird because it was happy earlier and the Preferences > Compiler executable is set to /usr/local/bin/fpc. The solution is to change that to /usr/local/lib/fpc/3.2.2/ppca64 instead. The IDE is successfully rebuilt but does not restart automatically: QuoteBuild IDE: Success, Warnings: 25, Hints 792 Warning: svn not in path. possibly due to the warning about svn? Quit the IDE. Unfortunately trying to then start Lazarus from either the startlazarus.app icon or lazarus.app icon in /Applications/Lazarus still results in the original Intel lazarus binary being launched. The correct aarch64 binary can be found in ~/.lazarus/bin/aarch64-darwin/lazarus. So the final solution is to: Quotemv /Applications/Lazarus/lazarus /Applications/Lazarus/lazarus.old mv  ~/.lazarus/bin/aarch64-darwin/lazarus /Applications/Lazarus/ You can then start the IDE with either the StartLazarus or Lazarus icons. I came across this while trying to re-compile the IDE from within itself to produce a native aarch64 version of the IDE as the delivered release IDE is an X86_64 binary. If anyone does try this, then be aware you need to go to Tools > Configure "Build Lazarus" and change the Target CPU to aarch64, check the Clean common files option and then Build. ---------------------------------------------------------------------- rossh_lz · 2022-02-04 13:51 Thank you trev for this information.  My experience was exactly as you described. Also after installing the aarch64 IDE, set the Preferences > Compiler executable setting, back to /usr/local/bin/fpc so now it will auto select the correct compiler type per the project settings. Further to the above - Debugging - what works and what does not?  This is what I found. I changed to the LLDB per step 5 here:  https://wiki.lazarus.freepasca l.org/Installing_Lazarus_on_macOS#Step_5:_Configure_the_Debugger With the original Intel x86_64 IDE build and LLDB, I can compile both aarch64 and x86_64 apps, but I found it will only debug the x86_64 app. With the aarch64 IDE build and LLDB, I can compile and debug both app types.  this is the preferred setup. Hope this helps.