rbenv
rbenv copied to clipboard
install gems when rbenv is installed system wide
When I deploy rbenv to be installed system-wide, I cannot install any gems on the installed host.
Do I need to install the gems with sudo gem install ...
?
Hi @khelben. Yes.
It's normal trouble: https://github.com/sstephenson/rbenv/issues/38 && http://stackoverflow.com/a/18555295
@zzet, there is an interesting problem (ubuntu 14.04.1) - when Ansible(1.8.2) runs a SUDO command scripts at profile.d are ignored. As a result env is not prepared and system version of gem
is run.
@vchervanev did you find the solution to this?
@blackjid I'd say Yes. In my case the right way is to use a 3rd party package (e.g. bright-box) since it isn't a dev machine and there is no need to switch between versions. However, if you need RBENV installed - there is a workaround. My initial conclusion was wrong - SUDO is not the reason, but a non-login shell session is.
I moved rbenv's init code to ~/.bashrc and it helped.
@vchervanev
I moved rbenv's init code to ~/.bashrc and it helped.
Like as per user installation? :)
@zzet exactly! 8-)
Updated: I had to source env vars at the beginning of .bashrc, I'm not sure if it equals to "per user installation"
When doing a system install, the module really ought to be doing the following:
-
ensuring the existence of rbenv group using
-
setting /usr/local/rbenv to be owned by the rbenv_group user
-
ensuring directories and files have the proper group ownership, e.g.:
sudo find /usr/local/rbenv -type d -exec chmod g+ws {} + sudo find /usr/local/rbenv -type f -exec chmod g+w {} +
-
ensure that the user has the rbenv_group appended to that user's groups list
If you do those things, either within your Ansible scripts or by hand, it works as expected.