How to use D on M2 macOS?

Brian Callahan bcallah at openbsd.org
Wed Aug 13 14:53:44 UTC 2025


On Thursday, 31 July 2025 at 10:19:43 UTC, IchorDev wrote:
>
> I'd love if you could get that added to the install.sh script. 
> I've attempted and failed to build GDC on macOS ~4 times. It's 
> such a huge pain because you need a functioning copy of GDC9, 
> and finding one that the GCC build system recognises is 
> seemingly impossible.

I did some thinking about this, and ended up writing my own 
script that will download, compile, and install GDC for you all 
automatically: https://github.com/ibara/gcc-bootstrap

Right now it only works on macOS, both arm64 and x86_64. Should 
be trivial to add other platforms, and it even helped me discover 
a bug in GDC.

Run it like this:
```sh
$ ./gcc-bootstrap.sh --bootstrap --with-d 15.2.0 /usr/local
```

Where `/usr/local` is the prefix you want to install into (this 
example will install gdc binaries into `/usr/local/bin`).

You'll need macOS 12.7.6 or later if on x86_64, 15.6 or later if 
on arm64. This will get you gdc-15.2.0 if on x86_64 and 
gdc-15.1.0 if on arm64. There is no release of GCC 15.2.0 on 
arm64 yet; the script will notice this and build 15.1.0 instead.

Happy to donate the script to the D team if it can be useful in 
promoting GDC.

~Brian


More information about the Digitalmars-d-learn mailing list