Can I install gems with apt-get on Ubuntu?

2020-05-22 12:52发布

I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126

I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?

Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?

6条回答
\"骚年 ilove
2楼-- · 2020-05-22 13:02

Ubuntu now have rubygems as a package

For Ubuntu 12:

sudo apt-get install rubygems

For Ubuntu 14.04:

sudo apt-get install rubygems-integration
查看更多
放我归山
3楼-- · 2020-05-22 13:03

If on Ubuntu 14.04 try below

sudo apt-get install rubygems-integration
查看更多
倾城 Initia
4楼-- · 2020-05-22 13:05

First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type

ruby setup.rb

That's it :)

查看更多
可以哭但决不认输i
5楼-- · 2020-05-22 13:07

If you install the full ruby application set with

sudo apt-get install ruby-full

You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.

查看更多
我想做一个坏孩纸
6楼-- · 2020-05-22 13:18

On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:

sudo apt-get install ruby-dev
查看更多
狗以群分
7楼-- · 2020-05-22 13:21

For Ubuntu

First install ruby:

sudo apt install ruby

Note that : sudo snap install ruby will throw this error :

error: This revision of snap "ruby" was published using classic confinement and thus may perform arbitrary system changes outside of the security sandbox that snaps are usually confined to, which may put your system at risk.

   If you understand and want to proceed repeat the command including
   --classic.

Finally, download latest tar version of ruby gems here: https://rubygems.org/pages/download

Unzip and cd to the folder and finally type in terminal:

sudo ruby setup.rb
查看更多
登录 后发表回答