how to install the new dmd on Mac M1?

Guillaume Piolat first.last at spam.org
Mon Aug 29 10:17:49 UTC 2022


On Thursday, 25 August 2022 at 14:19:47 UTC, MichaelBi wrote:
> I downloaded the new dmd 2.1 on Mac, but with fail message of 
> "unsupported Arch arm64". how can I do? thanks.


## Step 1

Get LDC here: https://github.com/ldc-developers/ldc/releases

- If you are running on Apple Silicon, be sure to use the 
Universal LDC package (for LDC version >= 1.30).

- If the "Universal" build is not available, use the x86_64 LDC 
package instead. (for LDC version < 1.30).

Those builds are cross-compilers, able to target both x86_64 and 
arm64, with flags -a x86_64-apple-macos and -a arm64-apple-macos 
respectively.


## Step 2

Make sure you are using the dub and ldc2 executable from those 
builds. Please install Xcode 12.2+ to.

     $ sudo ln -s /my/absolute/path/to/ldc-xxx/bin/ldc2 
/usr/local/bin/ldc2
     $ sudo ln -s /my/absolute/path/to/ldc-xxx/bin/dub 
/usr/local/bin/dub


- build a x86_64 program with: `dub -a x86_64-apple-macos`
- build an arm64 program with: `dub -a arm64-apple-macos`


More information about the Digitalmars-d-learn mailing list