"Gem Update --System Is Disabled on Debian" Error

gem update --system is disabled on Debian error

There are two ways: get rid of the debian ruby package and install ruby from source, or you can follow the instrucions given to you:

RubyGems can be updated using the official Debian repositories by aptitude or apt-get.

the rubygems with debian is managed by apt, and so you need to update it with it. If you don't want to, you need to install ruby on you own, without using apt. Or at least you need to install ruby-gems on you own. Try this:


[sudo] apt-get remove rubygems
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar xzf rubygems-1.3.7.tgz
cd rubygems-1.3.7
[sudo] ruby setup.rb

Can't update RubyGems

There is no need to take such drastic steps as completely rebuilding Ruby, reinstalling Rubygems from scratch or installing a version manager to solve this problem. There is simply a dependency cycle introduced by the release of hoe 2.3.0:

rubygems-update 1.3.5 requires (among other things) hoe-seattlerb

hoe-seattlerb requires hoe >= 2.3.0

hoe >= 2.3.0 requires rubygems >= 1.3.1

I wrote the blog post linked to by zipizap. To recap:

  1. If you've already tried to update, uninstall the latest rubygems-update first: sudo gem uninstall rubygems-update -v 1.3.5
  2. Update to 1.3.0: sudo gem install rubygems-update -v 1.3.0
  3. sudo update_rubygems
  4. Then update to latest: sudo gem update --system

With the release of Rubygems 1.3.6, it looks like this problem may be gone. From the release notes:

  • Development deps are no longer added to rubygems-update gem so older
    versions can update sucessfully.

How to install a gem or update RubyGems if it fails with a permissions error

You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

means exactly that, you don't have permission to write there.

That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.

Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.

Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.

gem cannot access rubygems.org

api.rubygems.org is currently experiencing issues with IPv6 setup: this hostname has 4 IPv6 addresses, but responds on neither of them. Neither to ping, nor to TCP connection attempts. When you are running gem, your gem tries IPv6 addresses first and times out on them, not having time to even try IPv4 addresses.

The solution is to lower priority of IPv6 addresses for api.rubygems.org, so that gem will try IPv4 addresses first. In order to do it, put these lines into /etc/gai.conf:


# Debian defaults.
precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
precedence ::ffff:0:0/96 10

# Low precedence for api.rubygems.org IPv6 addresses.
precedence 2a04:4e42::0/32 5

Operation not permitted - /usr/bin/update_rubygems

ended up installing ruby via homebrew. Install homebrew first:

http://brew.sh

then execute

brew install ruby

after that it worked flawlessly. It has something to do with the native ruby installation.

What's the deal with rubygems on Debian? It's different and strange

Note that what I wrote below has significantly changed recently. The Debian Ruby Team has more or less completely revamped their entire approach, including but not limited to their packaging of RubyGems. I'm not sure about Debian 6, but in the version after that, installing Ruby and the RubyGems package from Debian should be safe, maybe even recommended. And obviously, that is going to trickle down into Ubuntu as well.


[EDIT: The following is outdated as of Debian 7 at the latest.]

Mixing to two different package managers is generally a very bad idea. The Debian-Ruby team tries their best to patch RubyGems in such a way that it becomes a slightly less bad idea.

Also, Debian has a set of rules that are intended to keep the system consistent. RubyGems also has its own set of rules. Those two sets of rules are unfortunately not compatible. So, the Debian-Ruby developers patch RubyGems to respect Debian's rules instead of RubyGems's. Moving gems from /usr/lib/ruby to /var/lib is one of those things.

Another problem is that Debian stable is, well, stable. This means that the Debian team guarantees that the behavior of the entire system, all 20000 packages, will never change during a release. But the RubyGems developers don't make their bugfixes available separately, the only way to get a bugfix is to upgrade to a new version, with (potentially) different behavior. Therefore, the Debian-Ruby developers cannot just take the RubyGems sources unmodified, they have to reverse engineer the bugfixes from 1.3.7 and apply them to their version of 1.3.6, to ensure backwards compatibility.

In general, you should avoid mixing package managers. Either use RubyGems for everything (in which case it is best to install RubyGems from source instead of using the Debian package) or use APT for everything, in which case you might be interested in DebGem, a service by the Phusion guys (makers of Ruby Enterprise Edition and Phusion Passenger) which provides Debian and Ubuntu packages for pretty much all Gems.

How to upgrade rubygems

Install rubygems-update

gem install rubygems-update
update_rubygems
gem update --system

run this commands as root or use sudo.

how to update gem command in ubuntu?

RubyGems installed the following executables: /usr/bin/gem1.8

As the line says, the name of the program is gem1.8, not gem. Ergo, you need to call

gem1.8 -v

not

gem -v


Related Topics



Leave a reply



Submit