Home /

Notes to self /

Installing Crystal

Installing Crystal

It's a 3 minute read

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


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)"


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.

Usage: crystal [command] [switches] [program file] [--] [arguments]

    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.


© 2023 Alan Reid