Add a Gem to a Gemfile From the Command Line
Add a Gem to a Gemfile From the Command Line#
Use Bundler’s bundle add command.
bundle add mysql2
That adds the gem to Gemfile and runs bundle install.
You can also specify a version:
bundle add rails --version "~> 8.0"