Hi,
I’m a 44 year old economist having read and tried some Ruby on Rails a long time ago as well as learnt some C++ in school once. Would like to get into programming again, and Crystal appeals me.
However, my brew install crystal crashed with an error that it couldn’t find package dir (I think…).
I have installed Xcode command line tools, and assume I don’t need the full Xcode?
A bit unnerving for a first time installer, but I cleared the homebrew caches and tried again, and then SHA256 matched and it “poured bottles” instead of building every dependancy from sources (which still failed), and, voila, crystal 0.28 available.
BUT, when then running crystal play I get this after the browser has loaded:
Listening on http://127.0.0.1:8080
ld: library not found for -lssl (this usually means you need to install the development package for libssl)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc "${@}" -o '/Users/thomas1/.cache/crystal/crystal-run-play-1-1.tmp' -rdynamic -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf%s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre /usr/local/Cellar/crystal/0.28.0/embedded/lib/libgc.a -lpthread /usr/local/Cellar/crystal/0.28.0/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/local/Cellar/crystal/0.28.0/embedded/lib -L/usr/lib -L/usr/local/lib`
I see libevent in there and also reinstalled the xcode commandline tools and ran xcode-select --switch /Library/Developer/CommandLineTools as per the documentation but to no avail. Still the same error…
It said openssl was already installed (OSX 10.14.4), but the export of the PKG_CONFIG_PATH seemed to do the trick.
Since Mojave has been out since September 24, 2018 for macs from mid 2012 and newer, I created the pull request https://github.com/crystal-lang/crystal-book/pull/337 for the documentation to include this workaround in the style of the workaround for El Capitan already there.