
Where Does gem install Actually Go? Exploring the Ruby Filesystem
We type gem install rails or bundle install every day. Text scrolls down the screen, and suddenly we can use the library. But where did it go? Is it in your project folder? Is it in your operating system? How does Ruby know you have rails 7.1.0 and not rails 7.0.0 ? To master the Ruby environment, you need to understand the physical file structure. Here is what happens under the hood. 1. The Ruby Version Manager (The Traffic Cop) Before we talk about gems, we have to talk about Ruby itself. If you use a version manager like rbenv or asdf (which you should), you don't actually run the "real" Ruby when you type ruby . You run a Shim . When you type ruby -v , your shell looks at your $PATH . $ which ruby /Users/zil/.rbenv/shims/ruby This "Shim" checks your .ruby-version file, sees "3.3.0", and then redirects your command to the real physical location of that Ruby executable, usually hidden deep in your home directory: /Users/zil/.rbenv/versions/3.3.0/bin/ruby Key Takeaway: Every version o
Continue reading on Dev.to DevOps
Opens in a new tab

