In Rails, you manage external code libraries called gems using a file named Gemfile. You write the gems you want with version rules in this file. Then you run 'bundle install' which reads the Gemfile, finds compatible gem versions, downloads and installs them. Bundler creates a Gemfile.lock file that records the exact versions installed. This lock file ensures everyone working on the app uses the same gem versions, avoiding surprises. If you add or change gems, you must run 'bundle install' again to update installed gems and the lock file. Without running bundle install, your app won't find the new gems and will fail to start. This process keeps your Rails app's dependencies organized and consistent.