Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem install: ERROR: Failed to build gem native extension

I am using Arch Linux and installed Ruby (this is version 2.0.0).

When I installed Ruby it said I should add:

$(ruby -rubygems -e "puts Gem.user_dir")/bin

to my path, I added it to .bashrc

When I try to gem install rails or any other gem it gives the Error: Failed to build gem native extension. this is the full error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/lib/ruby/gems/2.0.0 directory.
[alexander@localhost ~]$ sudo gem install rails --no-user-install
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR="
sh: make: command not found


Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/atomic-1.1.10 for inspection.

When I look this error up I see that people solve this error by installing ruby-dev packages, however this does not exist for Arch Linux. Any other option that I can try?

Thanks in advance!

like image 784
Alexander Cogneau Avatar asked Feb 16 '23 02:02

Alexander Cogneau


2 Answers

To build native extensions you need the c++-compiler and tools. This is said clearly:

sh: make: command not found

Except of make utility you obviously need the compiler itself (e. g. gcc) and company. Thus,

sudo apt-get install gcc 

will do the trick. BTW, the properly suggested above RVM-way will definitely require build-tools as well.

like image 53
Aleksei Matiushkin Avatar answered Feb 24 '23 13:02

Aleksei Matiushkin


try this commands

sudo apt-get install ruby1.9.1-dev build-essential

sudo apt-get install ruby-compass

like image 45
Murali Krishna Avatar answered Feb 24 '23 13:02

Murali Krishna