6 ms·
Get started right with RVM
- deleted 16y ago[deleted]
- stevefink 16y agoRVM is one of those tools that you add to your arsenal that makes you go back and think how you ever got by without it before. This is particularly true if you are working on multiple projects, all of which have their own Ruby versioning/gem set requirements. It's incredible how trivial management has become when I'm dealing with 1.8.7, 1.9.2 and JRuby 1.5.2 (concurrently) on an almost daily basis.
- devin 16y agoAmen, brother. I don't know how I ever managed multiple projects before RVM. Thinking back, I don't think I'd ever call what I was doing "management"...
- cmelbye 16y agoHow does that gemset stuff fit in with Bundler? It's much easier for us to just keep Gemfile in the git repo, run "bundle install", and then let Bundler worry about installing gems and keeping a clean gem environment.
- swatermasysk 16y agoYou can use gemsets and bundler together. Gemsets simply allow you to have an isolated environment. If you want to install the gems from multiple projects in the same gemset the choice is yours. Bundler just makes installing each project's dependencies easier. The pattern I started to use recently was to check in include an .rvm file with the same gemset name as the project. This way, I simply clone the project, install bundler, and then issue bundle install and my project is ready to go.
- psadauskas 16y agoYou can do this automatically with rvm ruby@gemset --create --rvmrc `--create` creates a gemset if it doesn't already exist, and `--rvmrc` makes a .rvmrc file to automatically switch to that gemset when you cd into the current directory. This makes it easy enough, that I have a gemset per application/project, and then use bundler to install the deps.
- swatermasysk 16y agoProbably just personal preference, but for me, I like to have the .rvmrc file in source control so that I don't have to think about setting it up. The first time I navigate to the directory the gemset is created. Still a good tip. Thanks.
- jagtesh 16y agoNifty. Was searching for a how-to yesterday. Thanks!
- Construct 16y agoAnother important think to note when using RVM is to not use 'sudo' when installing gems. It is easy get caught up in a README or tutorial and execute 'sudo gem install...' as listed in the document. Unfortunately, this installs the gem in root's environment, which isn't configured with RVM goodness using the default installation method and you'll quickly end up with all sorts of problems and obscure error messages.
- mcantor 16y agoI discovered this last week and almost instantly donated some cash to the developer. It has easily already saved me hours of manual effort.
- reedlaw 16y agoAfter installing RVM if gem is giving you a zlib error, this info was useful on both Ubuntu and Debian: http://rvm.beginrescueend.com/packages/zlib/ http://rvm.beginrescueend.com/packages/zlib/ edit: I put up a short tutorial on how to get this running on Lenny: http://www.reedglaw.com/rails/InstallRailsRVM http://www.reedglaw.com/rails/InstallRailsRVM
- nanairo 16y agoPersonally I find it a bit of an overkill for me, and I doubt that it plays nice with other package managers... (if anyone knows more I'd like to hear more about it). That said I understand people doing a lot of work on other people's computers (e.g. Ruby on Rail) may find it really useful. Personally now it's 1.9.2 all the way! :D
- philwelch 16y agoThat's what kept me from it, but if you use Ruby you're already using two layers of package managers (your system package manager manages Ruby and RubyGems, RubyGems manages gems). Putting RVM in the middle just deepens that. Being able to quickly switch Ruby versions for different projects is a big convenience.
- nanairo 16y agoExactly. My fear actually started when I realised exactly that. Now, maybe it works beautifully... dunno, and if someone does please enlighten me. :) I can see the appeal of something like RVM. But despite using Ruby a lot, it's mostly stuff for myself so I just use whatever it's the latest. The reason why I thought about RVM was that I wanted to try MacRuby (and rare cases when I need to move back to the system's ruby) and was suggested to use RVM.
- Sirupsen 16y agoIf it's just you, doing stuff for yourself, RVM may not bring a lot of new to you: Correct. RVM is great to test against different versions (and implementations), especially if you do a lot of team-work: For instance, if you work in a team, or in production environments, the newest version of Ruby may be ahead of the production version, and then it's a must being able to switch from one version, or implementation, to another--painlessly. A personal use case I could come up with (there are a lot of them): You make an app., and it runs with Ruby 1.9.2. You deploy this app., and then Ruby 1.9.3 is released, and your app. is no longer compatible. You want to stay on the cutting-edge still, so you want 1.9.3, but your project is not compatible with 1.9.3, and still needs some work to be, since it's grown rather huge. Here RVM would be handy! When I was just toying around with Ruby, I didn't use RVM either. It's not until I've got work within the Ruby field, I've had the need for it. :)
- JangoSteve 16y agowe do not need to use sudo to install gems, as everything is kept in ~/.rvm It's not that you don't need to, it's that you shouldn't. Using sudo to install gems will do so outside of your rvm gemset, and so the gems you install this way will not be available to your app using the gemset.