I am facing a issue with RVM and installed ruby debian/ubuntu package.
As long as I have only installed RVM every works fine. I can use the ruby version which is provided/installed by RVM. Also if I install a gems package compass everything works fine. The RVM is installed as recommended by RVM as single user.
As soon as I install a ruby ubuntu package (which is mandatory for some other ubuntu packages and I have not a option to remove it) my RVM configuration is broken. I cannot execute anymore the compass (command not found) also trying to install it once again with
gem install compass
I am getting
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
Also
which ruby
which gem
Points to /usr/bin and not to my home?!?
Even if I have set
PATH=/home/rocky/.nvm/v0.10.38/bin:/home/rocky/.rvm/bin:...
I have no clue where to take a look since I am very new to ruby and to RVM. Hope someone can help me?
I am getting Permission denied - /var/lib/gems
/var/lib/gems is owned by root therefore you need to do:
sudo gem install compass
which ruby Points to /usr/bin and not to my home?!? Even if I have
set
This is probably because rvm is not running. Try this:
source ~/.rvm/scripts/rvm
which ruby
Note: Once rvm is loaded correctly, which ruby will point to different location and first question may no longer persist (and so do using sudo).
Related
I am trying to install a ruby gem in My Machine using xcode where I call a shell script.
cd "/Users/Desktop/gemfolder"
gem install somegem.gem
I am getting an error like this:
While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/1.8
Any workaround for it I am a newbie to ruby so don't know what to do anyhelp will highly appreciated.
Being sudo might fix your problem, however when you are installing gems , its not a good idea to install them as sudo, so the preferred way of installing ruby on any machine is to install rvm (Ruby Version Manager) first and then install your ruby version.
Main advantages of having a ruby version manager are,
1 - allows you to install multiple ruby versions side by side
2 - allows you to install gems for each ruby version (via gemsets)
So to install rvm in your mac, check here
list of ruby version managers
I am using Ubuntu 12.10 and I am trying to get my project up and running using rbenv and bundler.
I have successfully installed rbenv from the apt repository and installed the required version of ruby using ruby-build.
When I run which gem I get the global /usr/bin/gem that I assume came with the apt repository install. However when I run rbenv which gem I get the proper local gem /home/kasuko/.rbenv/versions/1.9.2-p290/bin/gem
However when I run gem install bundler I get an error on permissions with "Permission denied - /var/lib/gems" which leads me to believe that it is using the global gem.
So when I run /home/kasuko/.rbenv/versions/1.9.2-p290/bin/gem install bundler it successfully installs bundler
I do have the rbenv init line in my ~/.zshrc.local (which is sourced in my ~/.zshrc) and I get the updated path "/home/kasuko/.rbenv/shims:/home/kasuko/.bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" so I'm pretty sure it's installed correctly.
So why aren't my rbenv shims being used?
Thanks
Kasuko
If you're not sure which gem is being executed, try gem env which will show you useful information about the version of gem you're running, such as the rubygems version, corresponding ruby executable, gem paths and other good stuff.
Your PATH seems correct. Try running hash -r to clear the shell's cache of executable paths just in case.
Once you've done this, which gem should give you /home/kasuko/.rbenv/shims/gem, which would indicate that it's deferring to rbenv to determine the actual executable to run.
You may then need to run rbenv rehash. This should be run every time you install a new gem with an executable (like bundler, rake, etc). It will update all the shims to point to the correct executables.
I get the following error when trying to install rubygems version 1.3.7
~/Downloads/rubygems-1.3.7
$ ruby setup.rb
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem
Any idea what is cause this. I've previously installed RVM.
Thanks
Run the command
sudo !!
Rather than mess with your system installation of Ruby, consider using RVM to manage your Ruby installation(s). RVM will install multiple Rubies on demand, allow you to create various gem sets, copy them between versions of Ruby, all while sandboxing your Ruby installation in ~/.rvm.
Installing RVM
I have installed Ruby 1.9.2 from source. But it seems there is some trouble recognizing the bundler gem which I have already installed.
My /etc/environment file:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"
It looks like my gems are in /usr/local/ruby/gems/1.9.1/gems/.
In my rails application when I attempt to run sudo bundle install I get an error:
sudo: bundle: command not found
Also, why do the directories say 1.9.1?
Type which ruby to see the path your system thinks ruby is in.
Did you use a --prefix=... option for configure when you set up the configuration? Normally Ruby from source wouldn't be in /usr/local/ruby/bin. The Ruby executable would be in /usr/local/bin/ruby, but that is not how you'd set up your PATH to use it, so that looks suspicious. Notice that your path already contains /usr/local/bin so if Ruby installed into the normal location for a source-installation, that path will pick it up and your final search of /usr/local/bin/ruby will be wrong and unnecessary.
If you installed the gem before you installed the new version of Ruby then the gem would be part of the previous installation, not the current one, and wouldn't be visible to it. They're separate installs.
Unless you are trying to do a system-wide install for multiple users there is no real reason to compile from source and allow it to install to /usr/local/bin. I highly recommend installing RVM, then letting it install any Ruby versions into RVM's ~/.rvm sandbox. Gems will also be installed relative to the currently enabled RVM controlled ruby, which is a really good thing.
When trying to install gems using rvm i get this error
$ rvm gem install sproutcore
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/tee/.gem/specs
but it says on the rvm site that you should not use sudo so I'm not sure whats wrong with my setup
when i type $GEM_HOME it shows that the directory is pointing to the rvm dir
$GEM_HOME
bash: /home/tee/.rvm/gems/ruby-1.8.7-p302: is a directory
Any ideas what I'm doing wrong?
There's a permission issue with your .gem folder. Make sure the owner is your current user.
sudo chown -R tee /home/tee/.gem
If it doesn't work, remove the .gem folder. It is automatically created when you update the gem cache.
Also, make sure you never used sudo with rvm.
I was having the same problem. I redid this command
user$ source ~/.rvm/scripts/rvm
from a new terminal window (as suggested when installing rvm and possibly overlooked when I was installing rvm) and things seemed to be fine after that
http://rvm.io/set/gem/
or just
$ rvm <ruby_version>
$ gem install sproutcode
This should definitely work.
its probably not the correct way of doing things but I found that using rvmsudo resolved the issue, eg
rvmsudo gem install rails
I was having the same problem because the RVM was installed globally, in /usr/local/rvm , so it had no permission to install gems in ruby directory.
The workaround is to use Single User Installation, this will install your rvm in your user's home directtory(~/.rvm) so it will have all necessary permissions to install the gemsets and gems.
If you want to know the subject better read https://rvm.io/rvm/install . You will see that Single User Install is the recommended .