I was having an issue trying to start a ruby 2.3.1 rails 4.2.8 application with bundle exec rails s where i was getting:
activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require': dlopen(.rvm/gems/ruby-2.3.1/gems/curb-0.8.8/lib/curb_core.bundle, 9): Library not loaded: #rpath/libcurl.4.dylib (LoadError)
Referenced from: .rvm/gems/ruby-2.3.1/gems/curb-0.8.8/lib/curb_core.bundle
The problem seems to be that the provided gem through bundle install was originally compiled against a newer version of curl than the one that comes with OSX.
One possible solution would be to install a newer version of curl using brew brew install curl and then link it as the system default brew link curl however that would replace the default OSX curl with the newer one and could cause system problems (or other compiled software could be expecting the default osx version of the libraries)
So the best solution is to install curl with brew without linking it brew install curl and then reinstall curb gem linking it to the brew curl libraries:
gem install curb -v 0.8.8 -- --with-ldflags=-L/usr/local/opt/curl/lib --with-cppflags=-I/usr/local/opt/curl/include
This approach worked fine for me and I decided to include it here to save time in case anyone else comes across the same issue I had
I had this problem as well because which curl returned /opt/anaconda3/bin/curl.
To fix this, I ran
conda remove curl
Then I could
gem install curb
Related
I am trying to install pgsql gem, but I have some strange encoding issue when trying to install. Whole app have just been migrated from windows environment to Linux environment, but only default gemfile was used. I have found that way to solve is to change locale in registry.rb, but as I mentioned, my environment is Linux. Gist of gem_make.out can be viewed here: gist
postgresql is installed and runing:
$ service postgresql status
9.3/main (port 5432): online
EDIT: Seems that this issue is only happening with pgsql gem, other gems are installing sucessfuly, for example, running $ gem install A_123 installs specified gem successfully.
According to similar question on SO, to which SO user grenierm5 pointed me,i t seems that installing ruby-dev headers for compiling extension modules did the trick.
sudo apt-get install ruby-dev && sudo gem install pg
I have the error below when installing rails on osx maverick. OpenSSL has been installed already. Does anyone know how to fix this issue?
$ gem install rails
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
You may need to update your OpenSSL CA Bundle, per these instructions from chruby about Ruby 2.1.2 which state:
Install 2.1.2
Note: MRI 2.1.2 requires OpenSSL >= 1.0.1.
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
tar -xjvf ruby-2.1.2.tar.bz2
cd ruby-2.1.2
./configure --prefix=/opt/rubies/ruby-2.1.2
make
sudo make install
Note: OS X users must update their OpenSSL CA cert bundle and properly set ./configure --with-opt-dir to compile against Homebrew's libraries:
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
tar -xjvf ruby-2.1.2.tar.bz2
cd ruby-2.1.2
./configure --prefix="$HOME/.rubies/ruby-2.1.2" --with-opt-dir="$(brew --prefix openssl):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix libffi)"
make
sudo make install
For me, it was enough to just update my OpenSSL CA cert bundle via Homebrew and then reinstall Ruby using ruby-install
brew tap raggi/ale
brew install openssl-osx-ca
ruby-install ruby 2.1.2
After I performed the above steps, the issue stopped presenting itself.
For me... I had tried installing ruby 2.1.2 with ruby-install (since I use chruby for my ruby version manager). I had tried manually installing openssl with homebrew, etc. But I still couldn't get ruby-install to successfully build ruby 2.1.2. I've also had similar issues in the past with installing rubies and ruby-build worked then so I gave I gave it a shot here and it worked! As I understand it, ruby-build is the installer used by rbenv.
What I did was:
rm -rf ~/.rubies/ruby-2.1.2 (This is where my ruby installs are installed at.)
brew remove --force openssl
brew install ruby-build
restart console to be safe
ruby-build 2.1.2 ~/.rubies/ruby-2.1.2
And success! ruby-build seems to be much smarter than ruby-install at successfully installing weird dependencies. I'm done with ruby-install at this point -- it's given me too many problems! (brew remove --force ruby-install)
I've had a similar issue.
A fix to rvm was introduced just yesterday, and it was not yet merged with rvm master branch, so this is how you do it:
rvm get branch /bugfix/3923_set_osx_brew_openssl_compiler_config
rvm install 2.4.0
gem install rails
If that works for you, go to the issue and tell the developer how much you appreciate his effort:
Recently I was struggling with ruby installations due to the recent auto-update in openssl version from 1.0 to 1.1.
I found out that the ruby version < 2.4 does not work with openssl version > 1.0.
I was not even able to revert back the openssl to 1.0 version because other libs has dependencies on it.
No other solution except the one given below worked for me:
brew install rbenv/tap/openssl#1.0
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl#1.0'
gem update --system
Now my ruby runs with openssl 1.0 whereas all other libraries are running on the default openssl version 1.1.
secure server is the reason of this issue. You can Install it by using this command:
gem install rails --source http://rubygems.org
by default its using https://rubygem.org as the source for the gem.
$ gem install rails ERROR: While executing gem ... (Gem::Exception) Unable to
require openssl, install OpenSSL and
rebuild ruby (preferred) or use non-HTTPS sources
so we can specify a source, http//:rubygems.org which is a non-HTTPS source.
I am getting the following error:
$script/console
Loading development environment (Rails 2.2.2)
/opt/ruby-enterprise-1.8.6-20080709/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
Where can i get the file and what directory should it go in?
Thanks!
The readline module is normally part of the Ruby package itself.
Did you manually build your Ruby install? If so, you want to make sure libreadline and its headers are installed, and build again.
On Debian/Ubuntu:
apt-get install libreadline-dev
Or on RHEL/CentOS, try
yum install readline-devel
Update:
You are using a very old release of Ubuntu. If you want to keep using it, open /etc/apt/sources.list in a text editor, and change all occurrences of archive.ubuntu.com to old-releases.ubuntu.com. Then, run apt-get update and try the above again.
I urge you to consider updating your installation, though. Ubuntu 7.10 hasn't seen security updates in quite a while, and using it in production is not recommended. Even if it's not a production machine, there's a good chance you'll run into further problems because of old versions of certain libraries/dependencies.
You need to install the ncurses and readline libraries.
On Ubunutu you could do
sudo apt-get install libreadline5-dev libncurses5-dev
and then you will have to recompile readline which comes with your ruby source
cd <ruby-src-dir>/ext/readline
ruby extconf.rb
make
sudo make install
If you are using RVM you could simply do
rvm package install readline
EDIT:
On newer RVM versions, this last command is
rvm pkg install readline
Add the following line to your Gemfile and run bundle update
gem 'rb-readline'
credits to similar question/answer at install ruby 1.9.3 using rvm on ubuntu
This easiest way to get relief from this problem,
just add to your Gemfile:
gem 'rb-readline'
And then run bundle install
Run the command
rvm requirements
It shows the requirements and dependencies. Install those and reinstall the ruby on rvm
rvm remove 1.9.2
rvm install 1.9.2
It works!
EDIT
If you can't find the requirements option update your rvm.
rvm update --head # older rvm
or use rvm upgrade
Maybe this is a bullshit answer, but I ran into this problem today after upgrading postgres from 9.5.3 to 9.6, along with which homebrew upgraded readline from 6.something to 7. I ended up rolling back my postgres to 9.5.3 and that resolved the issue.
I'm having an issue installing the memcached ruby gem on my Mac Pro machine with OS X Snow Leopard (10.6.4).
Memcache is installed and working fine and for most projects I use the memcache-client gem without issue, but this current project I need to use the memcached gem instead.
Installing the gem with env ARCHFLAGS='-arch x86_64' gem install memcached or just via the normal gem install memcached both give the same error when trying to run the application:
(in /src/mojotech/projectr)
dlopen(/Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle, 9): no suitable image found.
Did find: /Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle: mach-o, but wrong architecture - /Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle
However, running file on the rlibmemcached.bundle gives the correct arch?
cpjolicoeur#~/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib $ file rlibmemcached.bundle
rlibmemcached.bundle: Mach-O 64-bit bundle x86_64
I'm not sure what the problem is, or how to properly install the memcached gem for my system.
I was seeing the same exact error message on Snow Leopard, Ruby 1.9.1, and the memcached gem. I scoured the net for hours for an answer. Everyone suggested this solution, which did not change the error message:
# Did Not Work
sudo gem uninstall
sudo env ARCHFLAGS='-arch x86_64' gem install memcached
I also tried doing 'rake clean' and re-running extconf.rb on the gem. Same error.
Finally, I went through every past version of the memcached gem until I found one that worked with my system.
# This Worked!
sudo gem uninstall memcached
sudo gem install --version 0.17.1 memcached --no-ri --no-rdoc
Version 0.17.1 of the gem is the only version that works for me. I'm an iPhone developer, so have the latest version of XCode installed, and this might explain why my system is different.
This is a late answer, but hopefully useful for someone who runs across the same issue. (With Ruby 1.9.2 on Snow Leopard.)
Install the Perl modules Pod::Simple, Pod::Man, Pod::Checker (via cpan is easiest).
Download the latest version of libmemcached from http://download.tangent.org/ (was libmemcached-0.44.tar.gz as of this post)
Do the configure/make/install dance by hand in Terminal:
tar -xzvf libmemcached-0.44.tar.gz
cd libmemcached-0.44
./configure
make
sudo make install
After this, sudo gem install memcached worked, and the Rails 3 app in question ran fine.
I'm try to install the SQLite gem on a Fedora 9 Linux box with Ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here's the command I'm running and its results:
sudo gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb install sqlite3-ruby
can't find header files for ruby.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out
gem_make.out just repeats what was already sent to the console. How can I install this gem?
The SQLite RubyGem isn't actually a RubyGem, it's a "CGem", IOW it's written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do that it needs the C header files for the Ruby interpreter.
If you compile Ruby yourself, those header files will be installed automatically, however, in RedHat-ish systems, such header files are usually packaged in a seperate package, called <whatever>-dev. So, in this case you will need to install the ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well.
However, you might be better off just installing your Operating System's pre-packaged libsqlite3-ruby package, that way all the dependencies are automatically satisfied.
(Note: all package names pulled out of thin air, might be different on your system.)
You probably need the ruby dev package. For Ubuntu you have to install ruby1.8-dev which includes the ruby header files. A quick google says that the yum package is ruby-devel. so run this:
sudo yum install ruby-devel
I faced problem installing sqlite3-ruby gem on my fedora 13 box.
It was fixed after sudo yum install sqlite-devel
When I had that problem:
gem install sqlite3 -v '1.3.9'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
For me worked, installing the "libsqlite3-dev" with:
apt-get install libsqlite3-dev
sudo apt-get install ruby-dev
Fixed it for me.
On Ubuntu 9 and 10 try:
sudo apt-get install ruby-dev
sudo apt-get install sqlite3-dev
Then run
gem install sqlite3
Run the following for Fedora OS:
yum install rubygem-sqlite3
On alpine, you need to install the sqlite-dev package.
I also faced this same issue, the problem is that your Linux installation requires the development libraries for SQLite3 to be installed in order to build the gem.
Here's how I fixed the issue
Open your terminal and run the following commands
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
And then try installing Sqlite3 gem again using this command
gem install sqlite3
That's all.
I hope this helps
Do you have all the source code required to build sqlite3-ruby? Gem is trying to compile some C code and cannot find the headers. You can probably use a fedora rpm for sqlite3-ruby (I don't use fedora, but I'm sure one exists) if you prefer to forgo compiling. Personally for ruby stuff, I prefer to use gem rather than a distro's packaging system.
I'm not really familiar with Fedora, but in Ubuntu when you are installing packages you have apt-get, and you have to install the build-essentials which includes gcc and other compilation tools for C. I would say that could be your issue, and you make look into how that can be install either using RPM or apt-get on Fedora.
I fixed the problem on my OLPC (Fedora 9) by installing 'gcc' oddly enough. It seems like it should have been one of those dev packages, but no.
Also, regarding the other packages, the suffix is "-devel", not "-dev", so make sure you get those ending right: "ruby-devel", "sqlite-devel"...
Once you get that installed, if you get errors about your gems being too old "< 1.3.1" when you try to run various rails scripts, eg: script/server or script/console, google "upgrade_rubygems" to fix that problem...
HTH...
Run "sudo yum install sqlite-devel" and then "gem install sqlite3". Had the same problem on my Fedora 15.
I had this same exact issue...instead of gem'ing the missing pieces I used synaptic on unbuntu.
The key package for me was libsqlite-ruby1.9.1 ... I documented my experience (for reference) with this error at :
Sqlite3-gem-error-during-bundle-install
I encountered this error while running bundle install after generating a react-rails app on Fedora 29. I was able to identify a suitable development package by running dnf search sqlite3, then installed it dnf install libsqlite3x-devel. This fixed it for me.