# Apple Silicon, LLVM, clang, Installation Issues Fix

**URL:** <https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018>\
**Category:** TidalCycles\
**Tags:** installation\
**Created:** [22 April 2022 09:03 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018 "2022-04-22T09:03:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![tillmanjex](https://uzu.lurk.org/user_avatar/uzu.lurk.org/tillmanjex/32/2244_2.png) [@tillmanjex](https://uzu.lurk.org/u/tillmanjex)\
**Post date:** [22 April 2022 09:03 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/1 "2022-04-22T09:03:07Z")

</div>

Hey all. Making a post for this as it covers a few of the common issues on Apple Silicon being posted here.

This includes:

- LLVM version not being found
- clang compilation problems

# LLVM

It seems that cabal doesn't see the native install of LLVM that ships with Mac. The error messages for me were noting that a version between 9 - 13 was requested.

1. Download LLVM v13 via homebrew: `brew install llvm@13`
2. Add `/usr/local/opt/llvm@13/bin` to your $PATH.
3. Restart your terminal and try again.

# Clang Compilation Problems

LLVM v13 comes with clang, but I was still getting clang compilation problems:

```Error
    (or GHC tried to execute clang incorrectly)

```

[It seems that GHC gets confused about which architechture it's running on(?).](https://gitlab.haskell.org/ghc/ghc/-/issues/18664)..  
Which could make sense, as the clang version of LLVM I had was targeting x86\_64 intel architecture, even though I'm on a fresh m1max mbp.

You can check with `clang --version`  
Then you can change the arch of your shell to match that of your clang target, and try compiling again.  
[Here is how to do that.](https://vineethbharadwaj.medium.com/m1-mac-switching-terminal-between-x86-64-and-arm64-e45f324184d9).

But what worked for me is I used the Apple command line tools clang instead by updating XCode and adding it to my $PATH:  
/Library/Developer/CommandLineTools/usr/bin

The developer tools version is targeting arm64, which is what makes me believe that worked for me.

---

<div class="post-metadata">

**Author:** ![mvdirty](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mvdirty/32/2179_2.png) [@mvdirty](https://uzu.lurk.org/u/mvdirty)\
**Post date:** [22 April 2022 14:16 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/2 "2022-04-22T14:16:03Z")

</div>

Alternatively, you can address all of the above in one fell swoop, by running the official process by which to ensure you have appropriate versions of llvm, clang, etc.: `xcode-select --install`

And, on a nearby note, if you need (or at least decide) to run some software in x86\_64 mode: `softwareupdate --install-rosetta`

(TBH, if I weren’t so completely and utterly slammed with work and other projects right now, I’d try to contribute some documentation updates. There are far too many threads, discord discussions, etc. like this one where people are jumping through extra hoops, installing extra tools like brew to help jump through them, etc. instead of using the official tools. 😕 )

---

<div class="post-metadata">

**Author:** ![tillmanjex](https://uzu.lurk.org/user_avatar/uzu.lurk.org/tillmanjex/32/2244_2.png) [@tillmanjex](https://uzu.lurk.org/u/tillmanjex)\
**Post date:** [22 April 2022 14:36 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/3 "2022-04-22T14:36:39Z")

</div>

I already had xcode and rosetta installed. But neither were being used it seems... 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![mvdirty](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mvdirty/32/2179_2.png) [@mvdirty](https://uzu.lurk.org/u/mvdirty)\
**Post date:** [22 April 2022 14:47 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/4 "2022-04-22T14:47:57Z")

</div>

Did you have Xcode, Xcode and the Xcode command line tools, or just the Xcode command line tools? (Of those it is the Xcode command line tools install which is critical in this instance.)

---

<div class="post-metadata">

**Author:** ![tillmanjex](https://uzu.lurk.org/user_avatar/uzu.lurk.org/tillmanjex/32/2244_2.png) [@tillmanjex](https://uzu.lurk.org/u/tillmanjex)\
**Post date:** [22 April 2022 16:05 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/5 "2022-04-22T16:05:21Z")

</div>

Not experienced enough to say exactly, but I installed with `xcode-select --install. `  
During this troubleshooting I then updated the CLI tools.

---

<div class="post-metadata">

**Author:** ![mvdirty](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mvdirty/32/2179_2.png) [@mvdirty](https://uzu.lurk.org/u/mvdirty)\
**Post date:** [23 April 2022 15:14 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/6 "2022-04-23T15:14:52Z")

</div>

Hmm, another thing that does come to mind regarding various people’s issues locating installed dependencies is that if people are hacking around in the shared zshrc, for example, it is often overwritten/reverted during operating system updates. I’ve had to fix that up a couple of times in recent months, for some work-related development dependencies which require the information to be in the shared zshrc rather than in my user’s .zshrc.

Long story short: if people are having to fix things up, perhaps make sure to do so in the user’s .zshrc rather than the shared one, and consider backing both up before O/S updates (both because some installers will modify the shared one, even if it might be better if they updated the user’s one.)

---

<div class="post-metadata">

**Author:** ![ganz](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ganz/32/64_2.png) [@ganz](https://uzu.lurk.org/u/ganz)\
**Post date:** [11 July 2022 14:15 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/8 "2022-07-11T14:15:19Z")

</div>

> [@tillmanjex](#):
>
> Add `/usr/local/opt/llvm@13/bin` to your $PATH

@tillmanjex How do I do this? How do I add /usr/local/opt/llvm@13/bin` to my $PATH ?

It seems that I have the same issues on a M1 Macbook.

Always grateful for your help,  
Axel

---

<div class="post-metadata">

**Author:** ![mvdirty](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mvdirty/32/2179_2.png) [@mvdirty](https://uzu.lurk.org/u/mvdirty)\
**Post date:** [11 July 2022 15:07 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/9 "2022-07-11T15:07:53Z")

</div>

All of the common installation methods for llvm should add it to the path. How did you install llvm?

---

<div class="post-metadata">

**Author:** ![ganz](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ganz/32/64_2.png) [@ganz](https://uzu.lurk.org/u/ganz)\
**Post date:** [11 July 2022 17:25 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/10 "2022-07-11T17:25:52Z")

</div>

I used this tutorial:

> **[barbe\_generative\_diary](https://barbegenerativediary.com/tutorials/tidalcycles/tidalcycles-install-m1mac-en/)**
>
> Generative art diary of studio BARBE. Base in Japan.

and in the meantime I used this advise for adding a path:

> **[Add to the PATH on Mac OS X 10.8 Mountain Lion and up | Architect Ryan](https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/)**
>
> Thoughts from Ryan Hoffman, an experienced team leader, software architect and developer.

Now TC runs fine. Thank you for your help.

---

<div class="post-metadata">

**Author:** ![mvdirty](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mvdirty/32/2179_2.png) [@mvdirty](https://uzu.lurk.org/u/mvdirty)\
**Post date:** [11 July 2022 22:43 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/11 "2022-07-11T22:43:22Z")

</div>

I read that tutorial shortly after people were posting about it and, frankly, it seemed strange and overcomplicated (to put it politely.) I’m honestly not surprised if people could come out of it with an incomplete and/or fragile setup.

Glad to hear you got things sorted, of course. Have fun!

---

<div class="post-metadata">

**Author:** ![ganz](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ganz/32/64_2.png) [@ganz](https://uzu.lurk.org/u/ganz)\
**Post date:** [12 July 2022 11:05 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/12 "2022-07-12T11:05:11Z")

</div>

@mvdirty Yes, I agree, after all I would say it was more difficult to to get successfully through the whole installation process on an M1 than it was before on a macOS device.

Previously I was familiar with the manual installation process and my last two installations went without a hitch. Well, with the M1 it was a little different. My first attempt also with the manual process was unsuccessful, as was the automatic installation with the script.

So I tried it yesterday in a third attempt with the "How to" from barbegenerativediary, which is a variant of the automatic installation. Finally, the many tips, corrections and help here in the club - in this thread and others - were decisive for the success of the installation.

My thanks to the accumulated and shared knowledge of our community. Thank you all!

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [13 July 2022 19:50 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/13 "2022-07-13T19:50:11Z")

</div>

I helped someone install on a mac today who was having issues with LLVM. The answer was to install a newer ghc which doesn't use LLVM. I was happy to not have to install homebrew for them, or mess with any libraries.

To see what versions are installed and available:

```haskell
ghcup list

```

You might have to do this first:

```haskell
source .ghcup/env

```

I did this:

```haskell
ghcup install ghc 9.2.3
ghcup set ghc 9.2.3

```

Or to just install the latest I think you can do:

```haskell
ghcup install ghc latest
ghcup set ghc latest

```

---

<div class="post-metadata">

**Author:** ![mvdirty](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mvdirty/32/2179_2.png) [@mvdirty](https://uzu.lurk.org/u/mvdirty)\
**Post date:** [14 July 2022 14:55 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/14 "2022-07-14T14:55:38Z")

</div>

That’s great news. The Haskell / Apple Arm story is still far from sorted (e.g. even Stack itself is still somewhat broken on arm at this point, IIRC) but getting there (e.g. the developer macbooks at my day job now actually run into _less_ toolchain trouble on arm than on x86) and I love seeing every little step forward like this one.

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [15 July 2022 08:34 UTC](https://uzu.lurk.org/t/apple-silicon-llvm-clang-installation-issues-fix/4018/15 "2022-07-15T08:34:18Z")

</div>

I've updated the install script. Hope it doesn't break things more.. [Fiddle with ghcup settings to install latest haskell · tidalcycles/tidal-bootstrap@52f77ec · GitHub](https://github.com/tidalcycles/tidal-bootstrap/commit/52f77eca0baa50b729bf92607ce3ae9d4a3d97b3)

This script could be significantly improved, if any mac users fancy a go (I don't have access to one):
