Fixing Crystal Compiler Error in OSX 10.11

Adler @ 2016-01-09

I'm recently upgrading to OSX 10.11 El Captain and something went wrong with my Crystal compiler. Libraries are not linked properly and the following message bumped up when I wanted to compile or run Crystal programs:

ld: library not found for -levent

It turns out that people have already discussed this issue on last October. The problem is caused by that XCode does not look for libraries under /usr/local/lib directory anymore. There are two ways to solve this problem.

1. Redefine library path

export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"

You can check on stackoverflow if this does not solve the issue.

2. Reinstall XCode Commandline Tools

Run the following commands:

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

Basically it redefines the path as the previous method does but in a different way. This solves the problem for me, hope it solves your problem too. This should not be a problem after another OSX system upgrade.