crystalscript

A CLI that allows to use Crystal as a scripting language by caching build artefacts.

CrystalScript

A CLI that allows using Crystal as a scripting language by caching compiled binaries.

Install

shards build --production && mv bin/crystalscript ~/.local/bin/crystalscript

Usage

Run any Crystal script directly:

crystalscript my_script.cr

Make scripts executable with a shebang:

#!/usr/bin/env crystalscript

puts "Hello!"

Then:

chmod +x my_script.cr
./my_script.cr

Compilation Modes

You can specify different compilation modes with the -m/--mode argument.

normal is the default, it will produce an optimized binary with debug symbols.

#!/usr/bin/env crystalscript

## or

#!/usr/bin/env -S crystalscript --mode normal

release will compile an optimized binary without debug symbols, resulting in a much lighter binary.

Use it if you don't need the debug symbols and you want the cached binary to take as less space as possible.

#!/usr/bin/env -S crystalscript --mode release

dev will optimize for compilation speed, with debug symbols, resulting in a heavy binary.

Use it when you want to iterate faster when developing your script.

#!/usr/bin/env -S crystalscript --mode dev

More info about the usage of -S in the shebang line

Release Checklist

  • Increment version in shard.yml
  • If schema changed, increment SCHEMA_VERSION in db.cr
  • Git tag with new version
Repository

crystalscript

Owner
Statistic
  • 1
  • 0
  • 0
  • 0
  • 1
  • 20 days ago
  • February 1, 2026
License

Links
Synced at

Tue, 17 Feb 2026 00:57:03 GMT

Languages