RVM and “[gem] not found” errors

tl,dr: If your gems aren’t being found, check that you’ve got a current Ruby in RVM.

I had some fun tracking down why my installed gems were not being found today. I do my dev work in a virtual machine (VM) that handles most of the work with gems, but there are some commands that are run only from a physical machine, such as Capistrano tasks for deployment to our various servers. I wanted to put a patch on the staging server, and ran into the following:

bundle exec cap staging patch:apply FILE=patch.diff
zsh: command not found: cap

I checked that I had Capistrano installed by running gem list, and I had it. So I tried
bundle exec cap staging patch:apply FILE=patch.diff
zsh: command not found: bundle

I thought it was related to my terminal, maybe a bad path, some kind of RVM issue. I Googled around for RVM path issues with ZSH, and couldn’t find any places my configurations differed.

Eventually, I went to double-check which Ruby RVM was using, and got this:

$ rvm list

rvm rubies

* ruby-1.9.3-p448 [ x86_64 ]

# => - current
# =* - current && default
# * - default

Well, that’s interesting! I didn’t have a current Ruby! So I ran rvm use default, and lo and behold, my cap commands worked again.

Advertisements

About joanwolk

3 things I like: theater, food, geekery. 3 things I don't like: clichés, blisters, coffee.
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s