How to downgrade back to 0.36.1?

I tried upgrading to 1.0.0, unfortunately, I have 3rd-party shard dependencies which haven’t been updated to support 1.0.0 yet. So, I need to downgrade back to 0.36.1.

I see that @bcardiff updated the brew formula for 1.0.0. Is there a way to brew install crystal@0.36.1?

I really don’t want to have to try to build it manually on my machine…

I don’t think the homebrew formula supports older versions.
You can grab the .pkg from Release 0.36.1 · crystal-lang/crystal · GitHub

The --ignore-crystal-version may be helpful here. At least until those deps publish new versions, or you migrate off of them.

E.g. shards install --ignore-crystal-version.

1 Like

If the problem is that packages are not updated I would go with @Blacksmoke16 suggestions. It is likely that the package will run on 1.0 directly.

If you need or want to stick with 0.36.1 a bit longer you need to do some workaround for that on brew or download the .pkg or .tar.gz for your platform. I usually decompress the .tar.gz and use the ./bin/crystal on that folder directly.

1 Like

Any clues what’s with the message from pg ?

[~/git/pg_csvlog]$ shards update
Resolving dependencies
Unable to satisfy the following requirements:

- `crystal (>= 0.35.0, < 2.0.0)` required by `pg 0.23.1`
- `crystal (< 1.0.0)` required by `awscr-signer 0.2.1`
Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.

The problem is awscr-signer/shard.yml at master · taylorfinnell/awscr-signer · GitHub is saying it requires 0.31.0. It’ll need updated to specify the versions it supports. E.g. >= 0.35.0, < 2.0.0 or something along those lines.

As the error says, in the meantime you can use --ignore-crystal-version until the dep is updated, or you migrate away from it.

See RFC: shard.yml crystal semantic · Issue #365 · crystal-lang/shards · GitHub.

Thanks @Blacksmoke16 but why does the message mention pg amongst the requirements it is unable to satisfy? It looks like those requirements should be ok with crystal 1.0.

Either it’s trying to just tell you it couldn’t satisfy the requirements of your shard.yml and is showing the dependencies and what they require. Or it’s incorrectly showing you satisfied deps. Either way it could probably be improved a bit. Depending on what others think could prob file an issue at GitHub - crystal-lang/crystal-molinillo: A generic dependency resolution algorithm. Ported from

Thanks. That makes sense. I guess changing the message from

Unable to satisfy the following requirements:


Unable to satisfy one or more of the following requirements:

would be clearer, although excluding the ‘satisfied’ requirements from the list would be even better.

The error message is generated like that because crytal is yet another dependency. As any other package at that point. The solver found those two constraints incompatible between each other. That’s why it is showing them both IIRC.

Of course there is always room to improve wording.

Yes, @Blacksmoke16’s suggestion worked locally on my machine. Thanks for that!

Unfortunately, I don’t see how to use that with the Heroku build pack. The build pack even recommends using that flag in it’s output:

remote: -----> Installing Crystal (1.0.0 due to .crystal-version file) from done
remote: -----> Installing Dependencies... Resolving dependencies
remote: Fetching
remote: Fetching
remote: Fetching
remote: Fetching
remote: Fetching
remote: Fetching
remote: Fetching
remote: Fetching
remote: Fetching
remote: Unable to satisfy the following requirements:
remote: - `crystal (< 1.0.0)` required by `spec-kemal 0.5.0`
remote: - `crystal (~> 0.30, >= 0.30.0)` required by `kemal 0.26.1+git.commit.a819d4792bbc63d993d6dd2b15f9af5efb0c2d8c`
remote: - `crystal (~> 0.25, >= 0.25.0)` required by `db 0.9.0`
remote: - `crystal (< 1.0.0)` required by `pg 0.21.1`
remote: - `crystal (< 1.0.0)` required by `redis 2.6.0`
remote: Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.
remote:  !     Push rejected, failed to compile Crystal app.
remote:  !     Push failed
remote: Verifying deploy...
remote: !       Push rejected to ...

Is it possible to get the build pack to use that flag?

If it’s not possible, I’ll try the other options you suggested. Thanks!

I think you should be able to set SHARDS_OPTS=--ignore-crystal-version env variable as Configuration and Config Vars | Heroku Dev Center so it will be passed to the build pack

That’s a good idea, though it didn’t work. I don’t see any reference to SHARDS_OPTS in the build pack repo:

Though that would be nice to have.

SHARDS_OPTS is read directly by the shards executable. So it should really work if it’s properly set in the environment.


$ SHARDS_OPTS=--version shards
Shards 0.13.0 [dfb6a87] (2021-01-21)

That’s odd because I have it defined via the Heroku Dashboard:

And I can see it via the CLI:

$ heroku config
=== Config Vars
SHARDS_OPTS:     --ignore-crystal-version

However, it’s not being used when I do a git push heroku master.

I remember having to enable a feature flag on Heroku apps to make env vars available inside the buildpack (for a while it seemed unfortunately common for Rails apps to need to talk to the DB during asset precompilation?). Is that still a thing?

Those config wars might just be for your app’s runtime environment, not for the build environment where shards install runs.

I think you’re right. It looks like Heroku added support for ENV_DIR a while back. Though, I don’t belive the crystal buildpack uses it.

I entered a new ticket: Add support for ENV_DIR

Under Linux I use asdf, which also works on MacOS

$ asdf install crystal 0.36.1

$ asdf list

$ asdf global crystal 0.36.1
1 Like

Nice! Kind of reminds me of Ruby’s rbenv or rvm. I’ll give it a try.

I’m hoping the Crystal Heroku buildpack gets updated and eventually all of the 3rd-party shards which are hard-coded with crystal (< 1.0.0)