Gemfile
Gemfile is a manifest file used by Bundler to manage a Ruby application's gem dependencies. It specifies where to fetch gems (sources), the gems themselves, their version constraints, and optional groupings or platform requirements. The Gemfile is designed to be edited by developers, while Bundler resolves the dependencies and records the exact versions in Gemfile.lock to ensure reproducible installs across environments.
A typical Gemfile begins with a source line and may specify the Ruby version, for example:
You may also specify platform-specific gems, or different gems for production or test.
Gemfile.lock is generated by Bundler and records the exact gem versions resolved from the constraints in
- bundle install: installs gems from the Gemfile, creating or updating Gemfile.lock
- bundle update: updates gems within the constraints and updates the lock file
- bundle exec <command>: runs a command in the context of the bundle
The Gemfile is commonly used in Ruby projects, including Rails apps, but it is a general mechanism