Thursday, 29 March 2012

System-wide accessible gems

As I was configuring my system for my friend's rails project, I found that when I install gems are root, they are available only to the root user and system-wide. When I install something as root, I expect it to be accessible system-wide. So, I dug into the issue and found that it was happening so because /etc/gemrc was configured to install gems for root user only. Getting system-wide installation of gems was achieved by commenting out the following line in /etc/gemrc

gem: --user-install

Now, instead of getting installed in /root/.gem/ruby/1.9.1/gems/ gems were installed to /usr/lib/ruby/gems/1.9.1/gems/ and were available to all users. Previously installed gems had to be uninstalled and re-installed so that they were available to all users.

No comments: