# Crystal on M1 Mac, Big Sur

**URL:** <https://forum.crystal-lang.org/t/crystal-on-m1-mac-big-sur/3480>\
**Category:** Help & Support\
**Created:** [July 8, 2021, 5:35pm UTC](https://forum.crystal-lang.org/t/crystal-on-m1-mac-big-sur/3480 "2021-07-08T17:35:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![valbaca](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/valbaca/32/869_2.png) [@valbaca](https://forum.crystal-lang.org/u/valbaca)\
**Post date:** [July 8, 2021, 5:35pm UTC](https://forum.crystal-lang.org/t/crystal-on-m1-mac-big-sur/3480/1 "2021-07-08T17:35:00Z")

</div>

Hi, trying to install Crystal:

```auto
$ brew install crystal
Error: crystal: no bottle available!
You can try to install from source with:
  brew install --build-from-source crystal
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.

$ brew install --build-from-source crystal
==> Downloading https://github.com/crystal-lang/shards/archive/v0.14.1.tar.gz
Already downloaded: /Users/valbaca/Library/Caches/Homebrew/downloads/243054e745fb64c2a2090ee74bd8f5492a73dce467d6eb2121c1de7362522dc3--shards-0.14.1.tar.gz
==> Downloading https://github.com/crystal-lang/crystal/releases/download/0.36.1
Already downloaded: /Users/valbaca/Library/Caches/Homebrew/downloads/21e69d67c3cd1545fe57b82418810e1e827581282b268d1daedf66006865f539--crystal-0.36.1-1-darwin-x86_64.tar.gz
==> Downloading https://github.com/crystal-lang/crystal/archive/1.0.0.tar.gz
Already downloaded: /Users/valbaca/Library/Caches/Homebrew/downloads/5e5007f36d96da96dc6b272be7532e052641f5b09706dbeb100477bde10d2944--crystal-1.0.0.tar.gz
==> make deps
==> make crystal release=true FLAGS=--no-debug CRYSTAL_CONFIG_LIBRARY_PATH=
Last 15 lines from /Users/valbaca/Library/Logs/Homebrew/crystal/02.make:
2021-07-08 10:24:43 -0700

make
crystal
release=true
FLAGS=--no-debug
CRYSTAL_CONFIG_LIBRARY_PATH=

Using /opt/homebrew/opt/llvm@11/bin/llvm-config [version=11.1.0]
CRYSTAL_CONFIG_LIBRARY_PATH="" CRYSTAL_CONFIG_BUILD_COMMIT="" SOURCE_DATE_EPOCH="1616422021" ./bin/crystal build --no-debug --release -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
ld: in '/opt/homebrew/opt/llvm@11/lib/libunwind.dylib', building for macOS-x86_64 but attempting to link with file built for macOS-arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `clang "${@}" -o /private/tmp/crystal-20210708-46787-11la4vt/crystal-1.0.0/.brew_home/.cache/crystal/private-tmp-crystal-20210708-46787-11la4vt-crystal-1.0.0-src-ecr-process.cr/macro_run -rdynamic -L/opt/homebrew/opt/bdw-gc/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/opt/llvm@11/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -L/private/tmp/crystal-20210708-46787-11la4vt/crystal-1.0.0/boot/embedded/lib -lpcre -lgc -lpthread /private/tmp/crystal-20210708-46787-11la4vt/crystal-1.0.0/src/ext/libcrystal.a -L/opt/homebrew/Cellar/libevent/2.1.12/lib -levent -liconv -ldl`
make: *** [.build/crystal] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!

```

Here’s my relevant flags, not sure if they matter:

```auto
env | grep FLAG
XPC_FLAGS=0x0
NVM_CD_FLAGS=-q

```

---

<div class="post-metadata">

**Author:** ![valbaca](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/valbaca/32/869_2.png) [@valbaca](https://forum.crystal-lang.org/u/valbaca)\
**Post date:** [July 8, 2021, 5:56pm UTC](https://forum.crystal-lang.org/t/crystal-on-m1-mac-big-sur/3480/2 "2021-07-08T17:56:04Z")

</div>

Looks like this is known:

> <https://github.com/mint-lang/mint/issues/386>
>
> I tried to install mint-lang on Mac mini m1 and encountered the following error:…
> 
> \`\`\`zsh
> $ brew install mint-lang
> ==\> Installing mint-lang from mint-lang/mint-lang
> llvm@9: The x86\_64 architecture is required for this software.
> Error: An unsatisfied requirement failed this build.
> \`\`\`
> 
> I googled the issue but found no related topic for this bug. 
> Any advice?

> <https://github.com/crystal-lang/crystal/issues/10237>
>
> os: BigSur 11.0.1
> cpu: Apple M1
> 
> expected result; be able to install Crystal
> …
> 
> result:
> \`\`\`bash
> % brew up
> Updated 1 tap (homebrew/cask).
> ==\> Updated Casks
> unnaturalscrollwheels wakeonlan
> russ@Russells-MBP ruby-install % brew install crystal
> llvm@9: The x86\_64 architecture is required for this software.
> Error: An unsatisfied requirement failed this build.
> \`\`\`

My arm/M1 brew is installed here:

```auto
$ which brew
/opt/homebrew/bin/brew

```

Step 1. Install x86\_64 brew under /usr/local/bin/brew

```auto
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

```

Step 2. Create an alias for the x86\_64 brew

I added this to my ~/.zshrc

```auto
# brew hack for x86
alias ibrew='arch -x86_64 /usr/local/bin/brew'

```

Step 3. ibrew install crystal

Step 4. Yay!

```auto
$ crystal --version
Crystal 1.0.0 (2021-03-22)

LLVM: 11.1.0
Default target: x86_64-apple-macosx

```

---

<div class="post-metadata">

**Author:** ![lilingxi01](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/lilingxi01/32/1217_2.png) [@lilingxi01](https://forum.crystal-lang.org/u/lilingxi01)\
**Post date:** [July 8, 2021, 11:34pm UTC](https://forum.crystal-lang.org/t/crystal-on-m1-mac-big-sur/3480/3 "2021-07-08T23:34:06Z")

</div>

I am not sure if you mean just installing the Crystal on M1 Mac or you want some specific environments.

If you just mean to install it and able to run the crystal on your terminal, you should check the pkg file.  
You can find the pkg file here: [Release 1.0.0 · crystal-lang/crystal · GitHub](https://github.com/crystal-lang/crystal/releases/tag/1.0.0)  
(It is actually installed onto the Rosetta 2)

And here is a known discussion:

> [@Install Crystal on Mac M1](https://forum.crystal-lang.org/t/install-crystal-on-mac-m1/3147):
>
> The basic homebrew command cannot install Crystal properly on Apple Silicon M1. And the “install” page did not mention anything about it. llvm@9: The x86\_64 architecture is required for this software. Error: An unsatisfied requirement failed this build. I have seen that we can try to install it under Rosetta 2, but I did not find any proper instruction related to this. I have tried a few ways to install brew and software under Rosetta 2 (found on google), but all of them are not working for Cr…
