Getting Started

This page will cover how to install Cosmo make your first program!

Installation

Cosmo Installer

If you want a quick cross-platform setup, then the installer is for you. You can find the latest release for the Cosmo installer here.

If you experience any problems or bugs, please create an issue.

From source

If you want to customize your installation, build your own fork of Cosmo, the installer isn't supported on your device, or you just don't want to use the installer, then this is for you.

  1. Download the source code.

  2. Install Crystal.

  3. If on OSX/Linux, run sudo make install . That's it. On Windows, just run shards build --release and add the bin folder to your PATH.

Writing a "Hello, world" program

To get started writing your first Cosmo app, first create a new folder.

I named mine test.

Now, create your Cosmo file. Cosmo sees files named main or the name of your project as an entry point. I will use the name of my project in this case, test, to give an example.

A main function is optional in Cosmo, except for if you want to accept the arguments the program was executed with. The args parameter is also optional. Be sure to mark your main function as public and return an int, which will be the exit code of the program.

What a full main function should look like.
The output of this script.

Last updated