|Posted by Guillaume Piolat|
in reply to Dave Chapman
Posted in reply to Dave Chapman
On Tuesday, 29 December 2020 at 19:04:33 UTC, Dave Chapman wrote:
> 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!)
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:
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.