Reputation: 871
I am trying to make my sass work, it was working fine but its has been a while since i worked on it, so today i wanted sass to watch my folder but that watch command didn't work. So i tired to check ruby version by
ruby -version
and i got reply
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] -e:1:in
<main>': undefined local variable or method
rsion' for main:Object (NameError)
But when i do gem install sass
it gives me error
While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
If i am not wrong, its telling of permission but i am the admin and i tried same command with sudo
Upvotes: 0
Views: 563
Reputation: 28305
The first error you're seeing:
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] -e:1:in ': undefined local variable or methodrsion' for main:Object (NameError)
is because you are running the wrong command. If you run ruby -v
or ruby --version
(note the two hyphens), you will see:
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
The error message you were seeing is because ruby can take the command line flag -e
to run code directly from the command line:
$ ruby -e 'puts "Hello world"'
Hello world
So by running ruby -version
(note the one hyphen), the ruby interpreter tries to evaluate a variable/method named rsion
and throws an error.
As for your actual error of installing gems, this is caused by having enabled rootless system integrity protection (on Max OSx). You can either disable the protection, as outlined in this post, or install ruby via RVM/RBenv to avoid needing sudo permissions for gem installation.
Upvotes: 2