Thread overview
How to Install D on my new MacBook with M1 ARM computer
Dec 29, 2020
Dave Chapman
Dec 30, 2020
Guillaume Piolat
Dec 30, 2020
Dave Chapman
December 29, 2020
Greetings,

Apologies If I have double posted.

I received a MacBook pro M1 for Christmas and I would like to install a D compiler on it. After looking at the downloads page I don't see how to install D on a new MacBook. I did not see a precompiled version to download with the possible exception of ldc for macOS with 64 bit ARM support (thanks Guillaume!)

Is there a precompiled version I can use?

Can I grab the x86 version of DMD from my old MacBook and have it work via Rosetta2?

Do I need to cross compile?

Is there a recipe somewhere that I can follow?

Thank you for any guidance you can provide,

Dave Chapman

December 30, 2020
On Tuesday, 29 December 2020 at 19:04:33 UTC, Dave Chapman wrote:
> Greetings,
>
> Apologies If I have double posted.
>
> I received a MacBook pro M1 for Christmas and I would like to install a D compiler on it. After looking at the downloads page I don't see how to install D on a new MacBook. I did not see a precompiled version to download with the possible exception of ldc for macOS with 64 bit ARM support (thanks Guillaume!)
>
>

Hello,

1. Download ldc2-1.24.0-osx-x86_64.tar.xz (or later version)
   from this page: https://github.com/ldc-developers/ldc/releases

2. Unzip where you want, and put the bin/ subdirectory in your PATH envvar
   This will give you the ldc2 and dub command in your command-line, however they won't work straight away...

3. In Finder, right-click + click "Open" on the bin/dub and bin/ldc2 binaries since it is not notarized software, and macOS will ask for your approval first. Once you've done that, dub and ldc2 can be used from your Terminal normally.

4. Type 'ld' in Terminal, this will install the necessary latest XCode.app if it isn't already. That is a painful 10 gb download in general. You can also install Xcode from the App Store.

5. You can target normal x86_64 (Rosetta 2) with:
      ldc2 <params>
      dub <params>

6. If you want to target arm64, adapt the SDK path in etc/ldc2.conf with your actual Xcode macOS11.0 path, and then use -mtriple=arm64-apple-macos to cross-compile.
      ldc2 -mtriple=arm64-apple-macos <params>
      dub -a arm64-apple-macos <params>

Let me know if you want to _distribute_ consumer software for macOS, there are a lot more complications with signing and notarization.




December 30, 2020
On Wednesday, 30 December 2020 at 00:22:14 UTC, Guillaume Piolat wrote:
> Hello,
>
> 1. Download ldc2-1.24.0-osx-x86_64.tar.xz (or later version)
>    from this page: https://github.com/ldc-developers/ldc/releases
>
> [...]

Thank you very much. This got me going. Right now I don't expect to be distributing any consumer software.

Dave Chapman