I have rvm installed, and the default set to 1.9.2. Whenever I try to get the dicom gem, I get these error messages:
$ rvmsudo gem install dicom
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
These errors happen after I run the instructions here, ie:
$ rvmsudo rvm remove ruby-1.9.2
$ rvmsudo rvm pkg install zlib
$ rvmsudo rvm install ruby-1.9.2
$ rvmsudo --default use 1.9.2
These errors also happen after removing all sudo apt-get installed ruby versions (ie, I ran sudo apt-get remove ruby*), and uses the most recent rvm (1.8 as of this question)
RVM instructions tell that you have to install ruby this way
rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr
after installing zlib package
Related
I am working through NativeScript's set-up on OS X El Capitan and I am stuck at the point where I am supposed to install xcodeproj and cocoapods. Almost everything that I try to do with gem shows the same error:
$ sudo gem install xcodeproj
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument
The following commands show the same error, wether I run it with sudo or not:
$ gem update --system
$ gem update
$ gem install whatever
$ gem install cocoapods
I have the following versions:
$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
$ gem --version
2.6.7
I've tried some of the help that I've found online, including reinstalling gem and ruby, restarting but nothing has helped.
I guess that I have a configuration problem with Ruby.
Any suggestions on how to troubleshoot this?
I just had a similar issue after updating everything via Homebrew.
I solved the issue by uninstalling Ruby and installing it via rbenv, then reinstalling cocoa pods.
Steps:
Uninstall ruby
brew uninstall ruby
Install rbenv and ruby-build
brew install rbenv ruby-build
You need to add Ruby to your path.
A. If Terminal is your shell.
Add eval "$(rbenv init -)" to ~/.bash_profile
B. Or if you use another shell
You can find the instruction by entering the command rbenv init NAME_OF_YOUR_SHELL.
Install Ruby
rbenv install 2.3.1
Set the Ruby version
rbenv global 2.3.1
rbenv local 2.3.1
Reinstall Cocoapods
gem install cocoapods
I get the error
Error installing jekyll:
jekyll requires Ruby version >= 2.0.0.
when I run
sudo gem install jekyll
"ruby -v" says I have ruby version 1.9.3
How do I install Jekyll? Do I need to upgrade ruby? If so, how?
Update - I installed ruby 2.0.0 with rvm but get the same error. Since trying to install with gem, could that still be trying to install with the older version of ruby? If so, how to find and change?
Try
sudo gem install jekyll -v 2.5
The default command apparently tries to install Jekyll 3, which was released on October 27th 2015. The 2.5 version still works with Ruby 1.9.3, and its quite allright for me, probably for you too.
I solved this issue the following way (assuming the ruby2.0 package is installed):
sudo rm /usr/bin/ruby
sudo rm /usr/bin/gem
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
Quick explanation:
/usr/bin/ruby and /usr/bin/gem are symlinks, you can check their target by entering:
ll /usr/bin/ruby
ll /usr/bin/gem
Changing the target of these links results in changing your default ruby and gem execution. Switching to version 2.0 for instance, lets you install Jekyll 3.
You can give a try to:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo gem2.0 install jekyll-import
I try the following on Ubuntu 14.04:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo apt-get install zlib1g-dev
sudo gem2.0 install jekyll
If you've already installed a later version of Ruby AND you're using rbenv, and gem gives the same error, it is because you are still using the old version of gem. There are now two executables called gem in your filesystem. Figure out which gem is the default with "which":
$ which gem
If you see something like */.rbenv/shims/gem, this is not the version of gems that you want to use. The correct version of gem will be in /.rbenv/versions/[your preferred version, i.e. 2.0.0]. You can run that version of gem by including the full path to the executable:
$ sudo /path/to/correct/gem install jekyll
I'm trying to install bundler gem on Mac OS Yosmite
~/code/hello gem install bundler
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I've done the following:
Install zlib through homebrew
Upgrade Rubygems
Reinstall RVM and Ruby 2.2.2
Switched to Rbenv and Ruby 2.2.2
This is really doing my head in. Ruby 2.2.1 works fine but 2.2.2 causes this issue whenever I try to install a gem.
Anyone got any ideas?
The following worked for me:
brew install homebrew/dupes/zlib
rvm reinstall 2.2.2 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8
Hope this helps anyone else who runs into it.
Try rvm pkg install zlib
(from this question)
RVM pkg docs: https://rvm.io/packages
It also looks like RVM has a more up to date way of managing packages called autolibs. Check rvm autolibs show, which I hope will be default(enabled) since you just installed. If it's not, rvm autolibs enable, or you can even tell it to use Homebrew instead of its own manager with rvm autolibs homebrew.
RVM autolibs docs: https://rvm.io/rvm/autolibs
I've been trying to install bro pages, but I'm hitting a wall.
I've managed to upgrade to Ruby 2.1.0:
craig#Craig-loaf:~$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
craig#Craig-loaf:~$ gem -v
2.2.1
But I try to install bro pages, like so:
craig#Craig-loaf:~$ sudo gem install bropages
ERROR: Error installing bropages:
mime-types requires Ruby version >= 1.9.2.
Which to me makes no sense.
I found some where on Stackoverflow a similar problem, where another gem had issues with being installed at they recommended adding --pre --no-ri --no-rdoc to the end, but I get this error instead:
craig#Craig-loaf:~$ sudo gem install bropages --pre --no-ri --no-rdoc
[sudo] password for craig:
ERROR: Could not find a valid gem 'bropages' (>= 0) in any repository
ERROR: Possible alternatives: bropages
craig#Craig-loaf:~$ sudo gem install mime-types --pre --no-ri --no-rdoc
ERROR: Could not find a valid gem 'mime-types' (>= 0) in any repository
ERROR: Possible alternatives: mime-types
So how can I get round this, and install bropages?
Is the sudo user set up to use a different ruby version (or any ruby version at all)? I've seen this happen before on UNIX machines where the main user is configured but the sudo user isn't. For example, the way I have things set up right now, > gem install {something} works fine, but > sudo gem install {something} claims it can't find the 'gem' command.
You might also try running without sudo. I don't sudo on my Linux machine, and I'm pretty sure my Mac doesn't require me to, either.
Try running 'sudo ruby -v' and 'sudo gem -v'. If that doesn't give you what you need to solve the issue, post the output to those commands here on the thread.
I got the above mentioned errors as well
I'm using Ubuntu 12.10 64bit.
bropages requires Ruby version 1.9.2, I had 1.8.7 installed. What fixed it for me is to install the latest version of ruby and install bropages gem in that so I could use it.
Here are the steps I took to install the latest version, and specify that as the one to use and to install bropages in that.
sudo apt-get update
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails
gem install bropages
Then finally I can use is like this:
bro curl
9 entries for curl -- submit your own example with "bro add curl"
# get the contents of a web page
curl http://bropages.org
bro thanks to upvote (22)
bro ...no to downvote (2)
Source: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
And http://bropages.org/
I had to do a lot of juggling when I tried to install Ruby 1.9.3, and it is mentioned in community that ruby1.9.1 is the package to be installed for Ruby 1.9.3. Now, if i run ruby, I get
<internal:gem_prelude>:1:in `require':
cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
What can I do?
FYI, I uninstalled everything in my comp by sudo apt-get remove --purge ruby1.8 libruby1.8
Then I installed Ruby1.9.1 by sudo apt-get install ruby1.9.1 libruby1.9.1
What do i do?
EDIT:
After the comments, I used rvm to install newer ruby 1.9.3, ANd now everything is perfect.
MORAL:
dont use apt-get for ruby. Use rvm, gem and other ruby tools. It's brilliant.
If you installed Ruby system-wide with apt then the latest RubyGems won't be included in the install. Ruby is the language, RubyGems is the package manager which has to be installed separately.
To install RubyGems just go here and follow the instructions:
Download from above.
Unpack into a directory and cd there
Install with: ruby setup.rb (you may need admin/root privilege)
For more details and other options, see: ruby setup.rb --help