Installing Crystal

Alan Reid
2 min readNov 15, 2021

So today I am going to go over installing Crystal. I will be working on a MacBook for this, but it should be pretty similar to most other systems.

What is Crystal?

Crystal is a pretty new programming language which should appeal to Ruby devs who demand more performance and flexibility.

This is because the Crystal syntax has been heavily influenced by Ruby, so it will feel natural to read and easy to write, with the added benefit of a lower learning curve for those of us who have Ruby experience.

For more info on Crystal, visit the Crystal homepage.

Homebrew

First off we need to make sure we install Homebrew it very simple to install. Be aware during install you may be asked you to install Xcode Command Line Tools, if so just say yes.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Cystal

With Homebrew installed we can now move on to installing Crystal, the current version at time of writing this is (1.0.0). You will need to enter the following commands into your terminal window.

# Install Crystal.
brew install crystal
# Check our Crystal version.
crystal -v

When we want to update Crystal to a new version, you would simply update brew first, then update Crystal.

# Update Homebrew.
brew update
# Update Crystal.
brew upgrade crystal

Crystal options

If you run crystal with no arguments, you can get a list of all available options for the compiler.

crystal
Usage: crystal [command] [switches] [program file] [--] [arguments]
Command:
init generate a new project
build build an executable
docs generate documentation
env print Crystal environment information
eval eval code from args or standard input
play starts Crystal playground server
run (default) build and run program
spec build and run specs (in spec directory)
tool run a tool
help, --help, -h show this help
version, --version, -v show version
Run a command followed by --help to see command specific information, ex:
crystal <command> --help

Well that’s a rather quick intro into getting Crystal setup, in my next posts I will go into setting up Lucky, which is a Framework similar to Rails but with some really nice features.

--

--

Alan Reid

Hi, I'm Alan! Rails developer, with a passion to create well crafted front-end experiences. Founder of Propiti