I am using rvm and ruby 2.1.0 in a project.
$~/ rvm version
rvm 1.25.33 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$~/ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
I want to use the dotenv
gem in that project, but I don't want to have that gem in the project's gemfile. So I installed it globally, and I can use it outside of my project:
$~/ gem install dotenv
$~/ touch .env
$~/ dotenv echo "works"
works
The problem is that once I enter my project (or any folder with a Gemfile) rubygems says that dotenv
"can not be found":
$~/ cd my-project
$my-project/ touch .env
$my-project/ dotenv echo "can not find dotenv"
/Users/kikito/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'dotenv' (>= 0) among 8 total gem(s) (Gem::LoadError)
from /Users/kikito/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
...
When I remove the Gemfile, dotenv
works again:
$my-project/ rm Gemfile
$my-project/ dotenv echo "dotenv works again as soon as I remove the Gemfile"
dotenv works again as soon as I remove the Gemfile
I am using zsh on a mac. My .zshrc seems to be ok (rvm does not complaint about unconfigured paths or anything)
# ~/.zshrc
source $ZSH/oh-my-zsh.sh
...
PATH=$PATH:/usr/local/go/bin:$GOBIN # Add golang binaries
PATH=$PATH:/usr/local/share/npm/bin # Add node binaries path
PATH=$PATH:/usr/X11/bin # Add xquartz to path, so xvfb is detected
...
# RVM
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
Here's the output of rvm info
in case it helps. It's the same output from inside and outside of my-project
.
Is this a regular rvm thing, or do I have some missconfiguration? Can I make this work, or do I have to put dotenv on the Gemfile?
This is probably due to rubygems-bundler
, which RVM installs by default. Try running
$ NOEXEC_DISABLE=1 dotenv echo "whatever"
If that works, you could do export NOEXEC_EXCLUDE="dotenv"
to stop dotenv
from sing Bundler all the time.