0

please, i need help!!! i am really new on all this installation i try to install ruby mine and it s give me all time this error 'Cucumber gem ist't installed for ruby -2.0.0 - p 481 SDC' i have mac and install one universal version of ruby when i put it on terminal - it s always give me this answer

tests-MBP:~ annasena$ gem install cucumber 
ERROR: While executing gem ... (Gem::FilePermissionError) 
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. 
Casper
  • 33,403
  • 4
  • 84
  • 79
Anna Sena
  • 11
  • 2
  • 1
    Please format the question properly. – Jagdeep Singh Mar 22 '18 at 12:56
  • 1
    How did you install ruby? – Jagdeep Singh Mar 22 '18 at 12:56
  • i install ruby from this link https://www.jetbrains.com/ruby/ – Anna Sena Mar 22 '18 at 13:12
  • guys don't downvote total noobs. You were one once. You need a proper install of a modern ruby. I recommend https://rvm.io/rvm/install – lacostenycoder Mar 22 '18 at 13:57
  • i am all ready use command sudo gem install cucumber, and it s give this error tests-MBP:~ annasena$ sudo gem install cucumber Password: ERROR: Error installing cucumber: cucumber-core requires Ruby version >= 2.1. tests-MBP:~ annasena$ and i can t install 2.1 , because for mac exist only universal 2.0 – Anna Sena Mar 22 '18 at 14:29
  • 1
    How about you install ruby with [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/) and dont use system ruby? Here is [an article about that](https://chrisherring.co/posts/why-you-shouldn-t-use-the-system-ruby) – Martin Mar 22 '18 at 15:28
  • OMG,i DO it. install version of ruby 2.1.0 for this link rvm.io/rvm/install – Anna Sena Mar 22 '18 at 18:28
  • Does this answer your question? [You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)](https://stackoverflow.com/questions/51126403/you-dont-have-write-permissions-for-the-library-ruby-gems-2-3-0-directory-ma) – monfresh Feb 26 '21 at 01:39

2 Answers2

0

You're using the system-wide Ruby, and it stores its gems in /Library/Ruby/Gems/2.0.0.

In order to install gems into a system location, you need root permissions. To give gem install root access, you just run it with sudo:

sudo gem install cucumber
Casper
  • 33,403
  • 4
  • 84
  • 79
  • i am all ready use command sudo gem install cucumber, and it s give this error tests-MBP:~ annasena$ sudo gem install cucumber Password: ERROR: Error installing cucumber: cucumber-core requires Ruby version >= 2.1. tests-MBP:~ annasena$ and i can t install 2.1 , because for mac exist only universal 2.0 – Anna Sena Mar 22 '18 at 14:43
  • @AnnaSena Use RVM instead to install Ruby locally under your own user account. Go to rvm.io and follow the instructions there. That way you can install any Ruby version you like. – Casper Mar 22 '18 at 15:17
0

This is a common problem people run into with Ruby on a Mac. As some people have mentioned in the comments here, the best way to install Ruby on a Mac is with a version manager. Even though Macs come with Ruby already installed, that version of Ruby should not be used for installing gems. And whatever you do, you should never use sudo to install gems.

For more details on how to install Ruby with a version manager, check out my answer to a similar question here on Stack Overflow.

monfresh
  • 7,974
  • 1
  • 25
  • 22