W3cubDocs

/Crystal 0.31

On macOS using Homebrew

To easily install Crystal on Mac you can use Homebrew.

brew update
brew install crystal

Troubleshooting on OSX 10.11 (El Capitan)

If you get an error like:

ld: library not found for -levent

you need to reinstall the command line tools and then select the default active toolchain:

$ xcode-select --install
$ xcode-select --switch /Library/Developer/CommandLineTools

Troubleshooting on macOS MacOS 10.14.2 (Mojave)

If you get an error like:

ld: library not found for -lssl (this usually means you need to install the development package for libssl)

you may need to install OpenSSL and link pkg-config to OpenSSL:

brew install openssl
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig

As with other keg-only formulas there are some caveats shown in brew info <formula> that shows how to link pkg-config with this library.

The Crystal compiler will by default use pkg-config to find the locations of libraries to link with.

To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/docs/installation/on_mac_osx_using_homebrew.html