Should rbenv be installed system-wide, or at a user level?

♀尐吖头ヾ 提交于 2019-12-03 06:09:17
Duke

About two years ago, a discussion happened in github about shared installs, which appears to answer the question.

Synopsis: sstephenson (rbenv author) specifically doesn't like encouraging system-wide installs because of complexities with permissions, write access, etc. He believes adding robust support would make rbenv more complex, and simplicity is the goal.

EDIT

I've since come across fnichol's chef-rbenv cookbook, which, if you actually want to install a system-wide rbenv, gives a right and proper method, and you can automate it with Chef (I recommend knife solo).

It installs this to /etc/profile.d/ so it will run for all users, putting the proper ruby into the PATH.

rbenv should be installed at a user level.

Unfortunately, this means that when running gem install, you may run into the problem you saw:

You don't have write permissions into the {...} directory

You can solve this by setting the correct permissions on the ~/.rbenv directory.

sudo chown -R yourusername ~/.rbenv

After chowning the directory, you'll be able to run gem install without sudo.

Everything in rbenv's Readme is assume a local (per-user) installation in ~/.rbenv/ so i would assume that the official recommendation is to install it on a per-user basis.

Still, it's possible to install it globally. But you'll need sudo for all commands that need to writing rights. Installing new rubies, installing gems* and changing the global ruby version are the ones coming to my mind here, there might be more.

(*) Needing sudo for installing new gems is the default when you install your ruby through the default system routines like apt on debian, not needing sudo for it is actually a positive side effect of using ruby version managers that work on a per-user basis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!