What does the ~> symbol mean in a bundler Gemfile?

brad picture brad · Jan 2, 2012 · Viewed 16.6k times · Source

What does the -> mean next to a version number in a Gemfile?

For example:

gem 'sass-rails',   '~> 3.1.5'

Answer

Tim Brandes picture Tim Brandes · Jan 2, 2012

From the bundler website:

The specifier ~> has a special meaning, best shown by example:
'~> 2.0.3' is identical to '>= 2.0.3' and '< 2.1.'
'~> 2.1'     is identical to '>= 2.1'    and '< 3.0'.
'~> 2.2.beta' will match prerelease versions like '2.2.beta.12'.

See https://bundler.io/gemfile.html and http://guides.rubygems.org/patterns/#pessimistic-version-constraint