Keeping environments clean is the only way I manage dependencies and libraries on my development machine.
RVM - Getting Setup
Getting started with RVM on MacOS is pretty plain and easy. The RVM website also offers best practices tips and a nice basics page on why managing dependencies through a version manager keeps your dev environment clean.
With RVM, I can list the most recent version of ruby with
rvm list known and then install it with the command
rvm install ruby --latest. I also often list my current version I’m using with
rvm list rubies and it shows the current version of Ruby I am using.
RVM - Production
Although I found RVM awesome for my development machine, I found better results with chruby and docker images when hosting ruby on rails applications from a server. I have run into trouble with RVM configurations when moving them to new/different machines. I wrote a post earlier (Januaryish) covering microservices and I loved using a container setup for rails. The microservice architecture allowed me to spin up redis and mariadb containers with no problems and the container setup allowed the rails server to connect to these containers pretty easily.
NVM - Getting Setup
I also use yarn to build assets, but this is often done through a container.
NVM - Production
The second piece is ensuring assets are precompiled with the rails command