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).
Related
I try and gem install cocoapods I get an error :
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
what does it mean???
You need to be root to write into /Library, so you need to use sudo, as the instructions tell you:
$ sudo gem install cocoapods
I dont have admit rights in ssh machine so i could not install any gem
gem install json
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.9.1 directory.
is there any ways to install it without admin rights?
gem install --user-install json
This will attempt to install the gem into ~/.gem/[some subdirectory], which you should be able to write to. (By default gem is trying to write to /var, which you don't have permission to write as a non-admin.)
Note that you will have to append the location the gem is installed to to your PATH variable to use it (on install you should get a warning to that effect). See this blog post about --user-install for more info
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.
I need to install json because I get this error:
Could not find json-1.4.6 in any of the sources
I ran gem install json and bundle install but I was only able to install json-1.5.1 when I need json-1.4.6
I have gem 'json', '1.4.6' in my gemfile, so I'm not sure what's going on...
UPDATE
I get this error:
Installing json (1.4.6) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1216:in `chmod': Operation not permitted - /Library/Ruby/Gems/1.8/gems/json-1.4.6/CHANGES (Errno::EPERM)
After checking logs by running $ heroku logs
I found "An error occurred while installing json (1.4.6), and Bundler cannot continue.
Make sure that gem install json -v '1.4.6' succeeds before bundling."
I then removed 2 json entries from the Gemfile.lock and had no further issues.
Why did you run gem install json at all? Bundler takes care of that for you and will ensure that the correct version of each gem is installed (since sometimes dependencies require an older version). Run
gem uninstall json
bundle install
Also ensure you have source 'https://rubygems.org' at the top of your Gemfile.
As for the permissions info, you may have to run gem and bundle commands with sudo.
By the way, I highly recommend taking a look at and using RVM, particularly the gemsets feature. It will make your life infinitely better when developing Ruby apps. If you decide to do so, I'd also suggest trashing all the gems you've install using the system Ruby by running sudo rm -rf /Library/Ruby/Gems/1.8/. It's also important that when using RVM you don't have to use sudo when running gem (or bundle), which is not only safer but less typing too.
Please update your rubygems by executing the following command..
gem update --system
may be it will solve the problem. After updating your gem. Then run the following command to install json
gem install json
Now you can get json gem installed in your system.
Try:
$ sudo apt-get install ruby1.8-dev
If you're using rbenv, try rbenv rehash
I had this problem when trying to build a website with Jekyll.
Turned out I hadn't followed all the instructions at https://jekyllrb.com/docs/installation/ubuntu/
I don't know if it was the missing packages or commands into ~/.bashrc but it fixed the problem in two instances of Ubuntu in WSL
Remove the json entries from the Gemfile.lock file and try to re run bundle install..
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 .