开发者

How to install .gem files in Ubuntu 9.04

I am new to rails . i am trying to install开发者_运维技巧 gems from the source . I AM HAVING ClothRed-0.4.1.gem file . How can i install this gem manually . This .gem file had data.tar.gz and metadata.gz file ..


cd into the directory with ClothRed-0.4.1.gem

sudo gem install ClothRed-0.4.1.gem


First off if you installed rubygems through apt I would remove it and rebuild it from source; the version that's in the 9.04 repo is pretty old.

apt-get remove rubygems
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar -zxvf rubygems-1.3.7.tgz
cd rubygems-1.3.7.tgz
ruby setup.rb

Now follow the steps Mike gave you and you should be ready to rock.


I know you say you want to install gems from source and all that fun stuff, but I would highly recommend (if you are starting out especially) to go through the following and start using rvm, as it indirectly helps you keep your gems organized.

$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

and

rvm install 1.9.2 -C --with-readline-dir=/opt/local,--build=x86_64-apple-darwin10

(presuming you are setting up all your localhost etc on a MacPro) - still not met a windows RoR guy yet ;)

then

rvm use --create 1.9.2@rails3

for good measure you could do this:

$ gem install sqlite3-ruby
$ env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
$ gem install rails

then if you like

rvm 1.9.2@rails3 --default

Phewww after all that, when you now install gems they are related to a ruby build.See rvm docs for more info.

To test this has worked and you can now manage all your gems nicely:

try

gem list

then

rvm system

to revert to what you had

then

rvm 1.9.2@rails3

then

gem list

This is a nice way to keep your gems organized.

Sorry for turning this into a RVM answer, but if you use more than 1 machine rvm helps you stay sane ;)

PS: Saves cd'ing into dir with sudo etc etc like Mike suggested...that's not needed if you do it this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜