Recent

Author Topic: solution for installing Fpc and Lazarus on macOS 14+  (Read 1408 times)

rich2014

  • New Member
  • *
  • Posts: 37
solution for installing Fpc and Lazarus on macOS 14+
« on: October 16, 2025, 04:28:22 pm »
because Fpc is currently incompatible with the Developer Command Line Tools on new version macOS, errors may occur when rebuilding Lazarus or building packages/apps.

after research and comparison, we found that the simplest solution is to install XCode 15 and enable the Developer Command Line Tools included in it for building. this way we don't have to modify fpc.cfg everywhere, nor do we have to set -WM10.15 everywhere, and we can build the native Aarch64 version.

the specific steps are as follows:

1. download Xcode_15.xip from Apple's official website (not Developer Command Line Tools, but Xcode)
https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_15/Xcode_15.xip

2. double-click it to unpack as Xcode.app, change its name to Xcode15.app, and copy it to /Applications (it doesn’t matter if the app icon is abnormal)

3. enable the Developer Command Line Tools in Xcode 15
Code: Bash  [Select][+][-]
  1. sudo xcode-select -s /Applications/Xcode15.app
  2. sudo xcodebuild -license

4. build Fpc and Lazarus by fpcupdeluxe https://github.com/LongDirtyAnimAlf/fpcupdeluxe.
for Fpc, fixes-3.2 or 3.3.1 recommended.
for Lazarus, trunk or fixes-4.0 recommended.
no options are required.

5. it will give you a working FPC and Lazarus. Lazarus itself can be rebuilt, packages can be installed, and Lazarus can compile and debug apps normally.

good luck.


Cascade

  • Jr. Member
  • **
  • Posts: 72
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #1 on: October 16, 2025, 08:17:20 pm »
 :) That sounds great - thank you Rich2014!

Will give Xcode 15 a try.  Is it OK to have more than one version of Xcode installed at a time? (i.e. 15 and 16)

rich2014

  • New Member
  • *
  • Posts: 37
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #2 on: October 17, 2025, 06:18:44 pm »
yes.

multi Xcode are supported.

for Developer Command Line Tools, switch by xcode-select.

RussellM72

  • Newbie
  • Posts: 3
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #3 on: January 06, 2026, 08:27:59 pm »
Thank you!

I just used this recipe to successfully install Lazarus on macos Tahoe (26.2).

I was able to download Xcode 15 from Apple using the links on this site: https://xcodereleases.com/

Being new to Lazarus, and after I failed miserable to install Lazarus using the directions on the wiki: https://wiki.lazarus.freepascal.org/Installing_Lazarus_on_macOS

...I'm wondering why better directions aren't on the wiki. I'd make an attempt at editing it but, being new to both Lazarus and the wiki, I'm worried that I'd mess things up.

RussellM72

  • Newbie
  • Posts: 3
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #4 on: January 06, 2026, 10:30:24 pm »
Well, I went ahead and took the plunge and edited the wiki.

https://wiki.freepascal.org/Installing_Lazarus_on_macOS

I added a new section at the top titled: Installation on macOS 14+ (Sonoma (14.x), Sequoia (15.x), & Tahoe (26.x))

I can't believe how much time it took me and I'm sure it's not perfect but, I think it might help people with newer Macs to be able to install Lazarus & FPC.

Hansaplast

  • Hero Member
  • *****
  • Posts: 762
  • Tweaking4All.com
    • Tweaking4All
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #5 on: January 07, 2026, 04:01:10 pm »
Followed the instructions (thanks Rich2014), and building FPC+Lazarus which works for x86_64, and it works for AARCH64.

However building the cross compiler seems a different story.

Building FPC for AARCH64 first and then building the cross FPC compiler for x86_64 FAILS.

Code: Pascal  [Select][+][-]
  1. genmath.inc(606,5) Fatal: Internal error 2014051001

(Using Xcode 15 with the described steps, tried PFC 3.3.1 and trunk. They always fail.)

This is the code in genmath.inc that seems to fail:

Code: Pascal  [Select][+][-]
  1. type
  2.   TDA02 = array[0..2] of double; { 3 elements is enough for float128 }

The other way around however DOES work (which is surprising to me):
Building FPC for x86_64 and then building the cross compiler for AARCH64 works.

FYI: Using FPCupDeluxe 2.4.0h for this.
Tried FPC 3.3.1 and Trunk.

Any suggestions?
Been at it most of the day, including spending a lot of time online trying to find a fix or workaround before posting.


Hansaplast

  • Hero Member
  • *****
  • Posts: 762
  • Tweaking4All.com
    • Tweaking4All
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #7 on: January 07, 2026, 07:24:08 pm »
Thanks for replying DonAldredo - I may have posted that bug back in April 😉

Just felt like posting it here again - been working with x86_64 FPC and Lazarus in the meanwhile, but the debugger doesn't seem to work with AARCH64 binaries, so I ran into this issue again.

Just confused though: why does this bug specifically surfaces only with building the x86_64 cross compiler and not the regular x86_64 compiler?
(not expecting you to know the answer of course as you have already done quite some efforts to resolve it)

Cascade

  • Jr. Member
  • **
  • Posts: 72
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #8 on: January 13, 2026, 04:16:40 pm »
This issue also occurs with the Aarch64 Linux-x86-cross-compiler, not just Darwin-x86.  To workaround the lack of cross-compilers on Aarch64, I'm using the following setup, which seems to work - might be a useful approach?  (see attached diagram)
« Last Edit: January 13, 2026, 04:18:21 pm by Cascade »

Cascade

  • Jr. Member
  • **
  • Posts: 72
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #9 on: January 13, 2026, 08:08:14 pm »
Well, I went ahead and took the plunge and edited the wiki.

https://wiki.freepascal.org/Installing_Lazarus_on_macOS

I added a new section at the top titled: Installation on macOS 14+ (Sonoma (14.x), Sequoia (15.x), & Tahoe (26.x))

I can't believe how much time it took me and I'm sure it's not perfect but, I think it might help people with newer Macs to be able to install Lazarus & FPC.

Your instructions look good, nice and clear - thanks for taking the time to add them :)

When I remove the macOS quarantine attributes from FpcUpDeluxe I use a variation which I think targets quarantine only, and leaves any other xattrs intact (whereas it looks like -cr may clear all xattrs?).  For reference, here's what I use:

Code: [Select]
sudo xattr -r -d com.apple.quarantine fpcupdeluxe-aarch64-darwin-cocoa.app

Your method is shorter though, and I don't know whether there's any real difference in practice.

BradleySlavik

  • New Member
  • *
  • Posts: 10
Re: solution for installing Fpc and Lazarus on macOS 14+
« Reply #10 on: January 14, 2026, 02:37:22 am »
Well, I went ahead and took the plunge and edited the wiki.

https://wiki.freepascal.org/Installing_Lazarus_on_macOS

I added a new section at the top titled: Installation on macOS 14+ (Sonoma (14.x), Sequoia (15.x), & Tahoe (26.x))

I can't believe how much time it took me and I'm sure it's not perfect but, I think it might help people with newer Macs to be able to install Lazarus & FPC.

This looks great. Tahoe 26.2 does not work with Xcode 15. So eventually I will need to figure that out. My main machine, it appears now, was prematurely upgraded to 26.2.

To be explicit, it seems to build fine. When I create a "simple program" that prints out one line, after I compile it (which works, I can run from Terminal), when I click on the green triangle to run it, a window pops up saying "Excecution stopped". On previous versions a window (console?) would appear and the program would run in that window. That no longer works.

Of course, if anyone wants to point me in the right direction, it might save several hours of wasted investigation
« Last Edit: January 14, 2026, 07:27:14 pm by BradleySlavik »

 

TinyPortal © 2005-2018