ruby pkg and user gem/bundle privilege mismatch

Tomasz CEDRO tomek at cedro.info
Mon Jan 25 17:47:36 UTC 2021


On 25.01.2021 18:26, Gary Aitken wrote:
> (..) 
> I installed rails as root using "gem install rails --version '=5.2.4'
> What's the difference between a pkg install of rails and "rem install"?
> Is it possible to mix a system ruby installation and user gem installs?
> Do I need to install rvm in order to do that?

Not sure about ruby but in Python you have system wide packages that you 
install as root and you can use them but not modify as standard user.

Alternatively, you can install you own local Python Virtual Environment 
(venv) as standard user, so you can get independent working environment 
that does not depend nor modify the system packages (except you only 
need Python and VENV packages). You can then modify that local venv as 
standard user, add new packages, remove packages, etc. You can even have 
multiple different virtual environments separated for a different tasks 
(i.e. django web development, zephyr embedded environment, etc).

Summing up you should never install local packages as root to use them 
as standard user. You should rather create your own small virtual 
environment that you can fully control as standard user with no impact 
to the system (or when you cannot modify system for instance on the 
shared hosting environment).

This may come helpful:

https://stackoverflow.com/questions/486995/ruby-equivalent-of-virtualenv

Best regards :-)
Tomek

-- 
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info


More information about the freebsd-questions mailing list