What does tilde-greater-than (~>) mean in Ruby gem dependencies? [duplicate]

It means "equal to or greater than in the last digit", so e.g. ~> 2.3 means "equal to 2.3 or greater than 2.3, but less than 3.0", while ~> 2.3.0 would mean "equal to 2.3.0 or greater than 2.3.0, but less than 2.4.0".

You can pronounce it as "approximately greater than".

§ Pessimistic version constraint


it means bring any lower version equal or greater than, but not a major version.

So for example arel (~> 2.0.2), will use (if availble) versions

  • 2.0.2
  • 2.0.3
  • 2.0.? (as long as ? is >= 2)

but it won't use 2.1.?