Cannot install Ruby with homebrew - ruby

I'm trying to install Ruby using Homebrew. When I run brew install ruby I get
Warning: The post-install step did not complete successfully
You can try again using 'brew postinstall ruby'
And when I try that it says
Error: Directory not empty - /usr/local/Cellar/ruby/2.1.2_1/lib/ruby/gems
So I tried deleting the contents of that folder and now it says
Error: undefined method `symlink' for #<Pathname:/usr/local/Cellar/ruby/2.1.2_1/lib/ruby/gems>
Does anyone know why this happening?

you can track the issue at ruby: Fix undefined method and directory not empty errors #29986 or follow the discussion link

Related

Ruby - ERROR: While executing gem ... (URI::InvalidURIError)

Whenever I tried to install gems recently I am getting the below error
ERROR: While executing gem ... (URI::InvalidURIError)
the scheme http does not accept registry part: www-cache.reith.bbc.co.uk;htt
p: (or bad hostname?)
I am getting this error only recently. Earlier I could install all the gems without any issues. Now, only uninstalling of gems is possible.
I have gone through many solutions and I could find them not specific to my problem.
The issue is, when I copied the command sudo gem install fastlane –NV from the web, -NV contains a bad character, replace dash with a new one and it works fine

why is this sass command giving me an error

I am trying to learn sass so I can develop my front end skills a little bit more because that is what I hope to be some day. The only thing is I can't get sass to work.
Whenever I run the sass --watch . command it returns this error.
>>> Sass is watching for changes. Press Ctrl-C to stop.
write ./test.css
LoadError: no such file to load -- rb-fsevent
Use --trace for backtrace.
I did a bit of research on this error and it was suggested on this site to just simply install the rb-fsevent file that is missing so I ran the gem install rb-fsevent command and then got this error.
Fetching: rb-fsevent-0.9.4.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
so I did a bit of research on THIS error and it was suggested agin on this site to just run the install with sudo. So i did just that I didn't get an error so i was quite excited because I have been fighting with this for a while so i want back to the start of this question and ran the --watch command and got the same exact error. Can anyone help me fix this?
Your first error is because Ruby can't load the rb-fsevent gem. This could be because the gem is not installed. Trying to install the gem was a good idea.
Your second error is because you are trying to install the gem to a directory that you do not have permissions for. Using sudo to do the install is an acceptable solution. You can also do gem install --user-install to install to your home directory.
You are still getting the first error because even though the gem is installed, Ruby cannot load it. This could be because sudo installed the gem with the wrong permissions, or installed it to the wrong location, or Ruby is looking for it in the wrong location.
Thus your solution would be to
Locate the gem files you installed
Check that their permissions allow you to read them
Check ruby -e 'p $LOAD_PATH' to see if Ruby is looking in the right place for the gem

ERROR: While executing gem

Found today I couldn't get my 'jekyll server' to start, so I preceded to reinstall 'jekyll' but I get this error...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Then I tried 'sudo gem install jekyll' and it worked!
Can anyone explain what's going on?
Thanks!
Use rbenv to setup a ruby binary that is in your home dir (a writable path).
You get that error because you lack write permissions to the System dir. Don't try to get write perms there - that's just asking for trouble. Instead, install a ruby version manager.
rbenv is linked above. Some like RVM. You can google for the arguments that pro/con each. rbenv is "more unix-like" and that is a good reason on its own.
It is installing system wide , you can force a single user install as follow
gem install jekyll --user-install

cannot load such file --zlib

Ruby & Rails beginner here! Attempting to code out of my iPad 3rd gen using iSSH, Digital Ocean Server (using Ubuntu 12.10), DropBox, and Textastic editor. (There is always somebody trying to ice skate uphill!)
In my installation of Ruby I am following these directions: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-from-source
When I do step 3: sudo gem update --system
ERROR: Loading command: update (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::UpdateCommand
I've seen some posts that talk about RVM. Do I need to uninstall everything and start over with RVM? If so do I just delete the directory or is there an uninstall command for Ruby? Do I need to uninstall the libraries? How?
Any and all help is greatly appreciated.
try installing zlib package if you are using RVM.
https://rvm.io/packages/zlib/
rvm pkg install zlib
and reinstall all your rubies

Ruby gems installation error

When I am trying to install a gem or run anything with gem command, I see this warning,
Error loading RubyGems plugin "/Users/ender/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.9.0/lib/rubygems_plugin.rb": undefined method `first' for #<String:0x007ffedc0964f0> (NoMethodError)
I searched it but I could not find anything out.
What is the problem and how can I fix it?
Note: I cannot install any gems.
Thanks.
Try removing the /Users/ender/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.9.0 directory. There seems to be a problem with this gem.

Resources