Why does puts not print to console in build --release created executable

Hi all,

total Crystal (and Ruby) n00b, but an old hacker here ;-)

Does Crystal view the puts command as debugging?
Because both the “build --release” and “build --no-debug” cause “puts” to be “muted”!
If so, is there another way to communicate with the console?

Any ideas?


To be clear, crystal build, does just as it implies; it builds the application into a binary but it doesn’t run it. puts is a runtime thing, so you would have to of course run the application to see them.

$ crystal build app.cr
$ ./app


$ crystal app.cr
$ crystal run app.cr

See Using the Compiler - Crystal

1 Like

I don’t think I understand your question well.

Normally, the --release option would not prevent puts from being displayed.

puts "Hello world!"

crystal build hello.cr
crystal build --release hello.cr
crystal build --no-debug hello.cr

All of the above builds output Hello World.

Hello World!

I probably don’t understand exactly what you mean. I think it would be clearer if you showed us the actual code you wrote. That way we can avoid misunderstandings.