How to run Ruby code in a console using rbenv in Atom?


I getting started using Atom. As I am developing a Ruby on Rails application, I always like to have quick access to my development log, my test suite (using Guard to automatically run tests), to install new gems with Bundler, and to commit code with git. I have opened my project’s directory, so I see a directory tree in the sidebar. Now I would like to open a console (without leaving my editor). How can I do this? I also tried installing a few Ruby-related Atom packages, but I’m using rbenv, so I think some additional path/environment configuration needs to happen.

Thanks for your help!


See the term2 package.


Awesome! That’s exactly what I needed. I didn’t have to configure anything either. I just hit Ctrl+Alt+T and it opened up in the right directory, with rbenv correctly initialized. Thanks!


script package is another option. It uses /usr/bin/ruby by default so you have to add the following lines to to make it use rbenv instead. Happy hacking!

# Add rbenv PATHs
process.env.PATH = [process.env.HOME + "/.rbenv/shims", process.env.PATH].join(":")
process.env.PATH = [process.env.HOME + "/.rbenv/bin", process.env.PATH].join(":")