How to use D on M2 macOS?

Luna luna at foxgirls.gay
Mon Jul 21 13:54:35 UTC 2025


On Monday, 21 July 2025 at 13:52:52 UTC, Luna wrote:
> On Monday, 21 July 2025 at 13:29:23 UTC, Albert wrote:
>> Hi all,
>>
>> I am completely new to D, wished to try it out and write a 
>> small app in it. However, for the last couple hours I am ready 
>> to pull my hair out as I have no idea how to compile even a 
>> simplest hello world app.
>>
>> I installed ldc and dub (nowhere on the download page did it 
>> even mention that dub should be installed separately!) from 
>> home-brew, installed code-d for vscode, used the plugin to 
>> create a new project and that is as far as I've gotten.
>>
>> For example the plugin prompts me to "Compile serve-d", 
>> however doing so just fails with:
>>
>> ```
>> Error Command failed with exit code 127: rdmd 
>> "/Users/albert/.dub/packages/dfmt/0.14.1/dfmt/dubhash.d"
>> Failed to install serve-d (Error code 2)
>> ```
>>
>> And so on and so forth. Am I missing something obvious?
>
> I highly recommend using LDC2 from the official packages
> https://github.com/ldc-developers/ldc/releases/tag/v1.41.0
>
> I've additionally written a script that installs LDC 1.41 + 
> various tools and the latest main branch dub you can use here
> https://gist.github.com/LunaTheFoxgirl/3e14a3aa977c14398c902023e567268a

Also as a sidenote, the homebrew release of the compiler is not 
maintained by the D Language Foundation and in general is 
relatively far behind upstream.

I recommend uninstalling any D tools you've installed via 
homebrew and install using the upstream methods.

The crashes you encounter are due to a change Apple made to their 
dynamic linker and thread local variable support in macOS 15.4. 
LDC 1.41 fixes this issue; and unlike DMD can compile for arm64.


More information about the Digitalmars-d-learn mailing list