can't install any gem - ruby-on-rails

can't install any gem
ERROR: Loading command: install (LoadError)
dlopen(/Users/MacBookPro/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/MacBookPro/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle
Expected in: /usr/local/lib/libssl.1.0.0.dylib
in /Users/MacBookPro/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle - /Users/MacBookPro/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

Perhaps this problem has to do with a recent update of XCode. After a XCode update you need to do the following steps:
Open Xcode and accept the license agreement
Reinstall the Command Line Tools.
The second step seems to depend on your OS versions. Try xcode-select --install in your console. If that does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices.
After reinstalling the Command Line Tools try to rerun bundle install.

Related

'Expected in: flat namespace' Rails error while db:reset in Apple M1 processor macOs BigSur 11.4

I've recently acquired a macOs BigSur, unfortunately, I have had a lot of issues trying to install a Rails App. After some days coming over issues with forum answers, I have encountered an issue that I cannot solve and there's not too much on the internet about how to solve this.
Whenever I run the following command rails db:reset I get the following output:
dyld: lazy symbol binding failed: Symbol not found: _grpc_set_ssl_roots_override_callback
Referenced from: /Users/usr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/grpc-1.38.0/src/ruby/lib/grpc/grpc_c.bundle
Expected in: flat namespace
dyld: Symbol not found: _grpc_set_ssl_roots_override_callback
Referenced from: /Users/usr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/grpc-1.38.0/src/ruby/lib/grpc/grpc_c.bundle
Expected in: flat namespace
zsh: abort rails db:reset
I reviewed this Github issue https://github.com/grpc/grpc/issues/24846 and followed the steps marked by nilleb user to solve my first issue, but then I got into this error message which is also mentioned in the same thread but I couldn't find a way to solve it.
When I run gem list I get
grpc (1.38.0 ruby universal-darwin)
google-protobuf (3.17.3 ruby universal-darwin)
And my ruby version is
ruby 2.6.6p146 (2020-03-31 revision 67876) [-darwin20]
I read the posts made by the user premist but didn't know exactly what to do.
Could you please help me in this situation? I would really appreciate your help!
I have solved this problem. The issue was caused by my homebrew path, and I needed to install its folder in /usr/local/homebrew instead of /usr/opt/homebrew because /opt/homebrew is for ARM use (so I had to install with intel).
I uninstalled brew and all its tools such as rbenv, nvm, etc. Then, I installed brew again but with the arch flag x86_64 command: arch -x86_64 /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\". After this, I installed rbenv, nvm, and other tools always using arch flag: arch -x86_64

Unable to setup Cocoapods, pod setup --verbose command failed

I'm trying to install cocoapods on my mac to use for iOS apps. So before finding a cocoapod tutorial, I may have tried to install a cocoapod for an xcode project with pod init and some other random things. I don't think pod init worked but another similar command did something
I then decided it would be a better idea to follow a tutorial from the beginning, so I started with installing cocoapods with the sudo gem install cocoapods, which worked.
However, when I typed pod setup --verbose, terminal threw an error which also happened when I typed pod setup
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:49:in `run'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:22:in `load'
from /usr/local/bin/pod:22:in `<main>'
Please help, I can't find any answers on stackoverflow or any other website.
Based on the error message you are getting, it seems like you don't have command line tools installed. You need to install that and then go to Xcode -> Preferences -> Locations -> Command Line Tools and confirm you have current Xcode version selected there.

PostGIS Error - PG::InternalError: ERROR: could not load library

StandardError: An error has occurred, this and all later migrations canceled:
PG::InternalError: ERROR: could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
Referenced from: /usr/local/lib/libSFCGAL.1.dylib
Expected in: /usr/local/lib/libboost_serialization-mt.dylib
in /usr/local/lib/libSFCGAL.1.dylib
: CREATE EXTENSION IF NOT EXISTS "postgis"/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
ActiveRecord::StatementInvalid: PG::InternalError: ERROR: could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
Referenced from: /usr/local/lib/libSFCGAL.1.dylib
Expected in: /usr/local/lib/libboost_serialization-mt.dylib
in /usr/local/lib/libSFCGAL.1.dylib
: CREATE EXTENSION IF NOT EXISTS "postgis"
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
PG::InternalError: ERROR: could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
Referenced from: /usr/local/lib/libSFCGAL.1.dylib
Expected in: /usr/local/lib/libboost_serialization-mt.dylib
in /usr/local/lib/libSFCGAL.1.dylib
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
Am getting the above error all of sudden when i tried to drop and recreate my Rails-PostgreSQL
You probably recently upgraded the boost Homebrew formula doing a brew update / brew upgrade, and it seems the latest version is not playing well with postgis.
I fixed a very similar issue by going back to the previous version of boost with:
brew switch boost 1.58.0
UPDATE: now that this was fixed in Homebrew, the answer below suggesting to do a simple update / upgrade is probably the way to go. If you did switch previously, you can now brew switch boost 1.59.0 to upgrade to the latest version of boost, you might also have to brew reinstall postgis.
This issue has been fixed here. Re-install and it should work.
$ brew update && upgrade
$ brew install postgis
Couldn't find 1.58.0 either, but 1.55.0_1 is available and successfully installed postgis for me. These entries in effectif and stackoverflow were very helpful. The process may have extra steps.
Just to be sure:
$ brew uninstall postgis
Tap to homebrew versions, if not having it yet:
$ brew tap homebrew/versions
Find the newest available:
$ brew search boost
...
homebrew/versions/boost155
...
$ brew install homebrew/versions/boost155
This installs boost under a different formula (boost155). To be able to switch versions, I symlinked the old version to the boost directory:
$ ln -s /usr/local/Cellar/boost155/1.55.0_1 /usr/local/Cellar/boost/1.55.0_1
After this it is business as usual:
$ brew switch boost 1.55.0_1
$ brew install postgis
If you need to install a specific version of a formula, take a look at this thread:
Homebrew: install specific version of formula
I just ran into this problem as well, and version 1.56.0 of boostwas available and solved the issue for me. Looks like the problem is specifically with 1.58.0.

Error running '__rvm_make install' when installing openssl

I'm trying to set up Ruby on Rails on a Ubuntu server. I don't care which version of ruby as long as I find one that works, but I'm working with v2.1.0. Whenever I try to run any sudo gem ... commands I get the following error:
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I've figured that I just have to install openssl, but when I try it using rvm pkg install openssl it works for a while but then fails and gives the following output:
Checking requirements for ubuntu.
Requirements installation successful.
Fetching openssl-1.0.1g.tar.gz to /home/ubuntu/.rvm/archives
Extracting openssl to /home/ubuntu/.rvm/src/openssl-1.0.1g...
Configuring openssl in /home/ubuntu/.rvm/src/openssl-1.0.1g..................................
Compiling openssl in /home/ubuntu/.rvm/src/openssl-1.0.1g.............................................................................................................................
Installing openssl to /home/ubuntu/.rvm/usr.............................
Error running '__rvm_make install',
showing last 15 lines of /home/ubuntu/.rvm/log/1401942843/openssl_make.install.log
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/ubuntu/.rvm/src/openssl-1.0.1g/tools'
installing man1/CA.pl.1
installing man1/asn1parse.1
installing man1/ca.1
installing man1/ciphers.1
installing man1/cms.1
cms.pod around line 457: Expected text after =item, not a number
cms.pod around line 461: Expected text after =item, not a number
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number
cms.pod around line 474: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 71.
make: *** [install_docs] Error 255
+ return 2
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
Updating openssl certificates..
I have a few openssl directories all ready on my system and I've tried reinstalling ruby several times using parameters like --use-openssl-dir pointing to each one but I still get the exact same error shown at the top of this post. I'm sure that I have to somehow get rvm pkg install openssl to work. Any insight would be appreciated.
UPDATE Well I just nuked my version of ruby and installed it again fresh and it is working fine now.

LoadError: dlopen(digest/sha1.bundle): Symbol not found: _rb_Digest_SHA1_Finish

Ruby stopped working on my brother's machine recently.
gem commands
rails server
rails console
All failed with the following error:
$ irb
irb(main):001:0> require 'digest/sha1'
LoadError: dlopen(~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish
Referenced from: ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle
Expected in: flat namespace
in ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle - ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle
from ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from (irb):1
from ~/.rbenv/versions/2.0.0-p0/bin/irb:12:in `<main>'
He tried different versions of Ruby. Reinstalling everything with rvm. Running rvm implode and reinstalling rvm. Switching to rbenv. Several Rubies installed via ruby-build. brew install ruby.
All had the same problem.
If he uninstalled all rubies, the OS supplied version in /usr/bin/ruby worked. But it's 1.8.7.
After hours of troubleshooting, we arrived at the solution below. I hope it helps you avoid some pain.
Possible solutions:
$ unset C_INCLUDE_PATH and reinstall Ruby
This is the solution that worked for me.
$ echo $C_INCLUDE_PATH
If C_INCLUDE_PATH is set, it will break Ruby builds. Remove it from your environment; either temporarily with $ unset C_INCLUDE_PATH, or permanently (might be in .bashrc, .profile, .bash_profile); then reinstall ruby.
It might be related to OpenSSL, RVM, XCode's Command Line Tools (gcc), or other build issues.
See this answer if the previous solution didn't work.
For anyone, like me, coming here because of an error like this:
LoadError: dlopen(/Users/sebkomianos/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/sebkomianos/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
One solution (taken from here) might be to reinstall your version of ruby. eg: rbenv install 2.0.0-p247

Resources