brew unlink crystal-lang
brew install <url to formula> # check more on appendix below
If you'd like to check for installed crystal versions, just run:
brew switch crystal-lang 0
# Error: crystal-lang does not have a version "0" in the Cellar.
# Versions available: 0.15.0, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4
ps: 0 is just a dummy non-existing version so homebrew breaks and show you available versions.
Then you can easily switch to a specific version using:
brew switch crystal-lang 0.17.4
Being honestly, this approach is only useful if you need to build a project or run spec suite, if you have need to run a small snippet, use http://carc.in/ and make world a better place! :)