Installing Ruby gems-permissions error - ruby

Trying to install Ruby Gems (actually sinatra) on iMac-
Get these error messages
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory
rubygems-2.1.11 mark$ gem install sinatra
rubygems-2.1.11 mark$ ruby setup.rb
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Site/1.8/gauntlet_rubygems.rb
Any easy solutions?
Thanks!!

The easy solution is to not try to modify the version of Ruby that Apple installed for their own use.
Instead, use rbenv or RVM to install Ruby in a sandbox in your home directory where you can fold, spindle and mutilate it all you want.
If you go with RVM, take the time to read the entire installation page before beginning your install. Failure to do that is the #1 cause for problems using RVM. RBEnv on the other hand, is simpler but not as "feature-packed". Personally, I use and recommend the later.

Related

gem install pry FilePermissionError

When I tried to install pry on terminal, it keeps telling me
$ gem install pry
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0
directory.
I've tried to update gem, using homebrew to install ruby. but still get the same error.
Common Practices when something says what you don't have permission to perform an action:
Try to execute the command with sudo prefix (sudo gem install pry).
Execute the command as root (Not recommended due to potential issues).

Installing ruby gems Error: operation nor permitted - usr/bin/sprockets

Im trying to get rubymine to work but i always keep getting this error "operation not permitted"
Gabriellas-MBP:~ GabriellaKampe$ gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Gabriellas-MBP:~ GabriellaKampe$ sudo gem install rails
Password:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/sprockets
Gabriellas-MBP:~ GabriellaKampe$
You don't have permission to write to the gemfile directory of your the ruby version that comes bundled with your OS. What you'll have to do is manage your ruby versions using either rbenv or rvm. I will recommend rbenv and you can follow the guide on these links rbenv rails install Mac OS or rbenv rails install Ubuntu

using compass with RVM and installed native ruby?

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).

Ruby on mac not installing gem showing permission denied

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

Error installing rubygems

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

Resources