Problem with OpenSSL when starting rail server after upgrade Homebrew - ruby

I have an old Ruby React project that works fine. When I revisit again after months and start the rail server, I got the error as below.
I am trying a bunch of different solutions, but nothing works so I am totally lost.
I suspected this happened because I might upgrade my homebrew and it does not support SSL 1.0.0 anymore and the SSL old version (1.1.0) might be deleted as well.
MY SSL INFO:
ls -al /usr/local/Cellar/openssl*
total 0
drwxr-xr-x 3 resant staff 96 Oct 5 20:32 .
drwxrwxr-x 11 resant admin 352 Oct 5 20:29 ..
drwxr-xr-x 14 resant staff 448 Oct 5 20:32 1.1.1g
ERROR:
1: from /Users/resant/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Users/resant/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require':
dlopen(/Users/resant/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin17/digest/md5.bundle,9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
Referenced from:
Users/resant/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin17/digest/md5.bundle
Reason: image not found -
Users/resant/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin17/digest/md5.bundle
I try this solution:
brew update && brew upgrade
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
but when I run that brew install, I got the following error:
fatal: 'origin' does not appear to be a git repository fatal: Could
not read from remote repository.
Please make sure you have the correct access rights and the repository
exists. fatal: Needed a single revision invalid upstream
'origin/master' Error: Calling Non-checksummed download of openssl
formula file from an arbitrary URL is disabled! Use 'brew extract' or
'brew create' and 'brew tap-new' to create a formula file in a tap on
GitHub instead. If reporting this issue please do so at (not
Homebrew/brew or Homebrew/core):
https://github.com/tebelorg/Tump/issues/new
I don't understand this at all so I might be screw up things even more. Please help, how should I fix this?

Related

Fixing homebrew on Mac OSX 10.13.2

Just wondering if anyone can help fix homebrew for me. It was working a minute ago...
I am trying to install new packages using Homebrew on my 2 Macbooks. Both are running High Sierra, which I suspect might be the problem due to Apple borking root permissions...
Anyway, my issue goes a little something like this:
❯❯❯ brew install git
Error: git 2.14.2 is already installed
To upgrade to 2.15.1, run `brew upgrade git`
Okay. Lets upgrade Git.
❯❯❯ brew upgrade git
==> Upgrading 1 outdated package, with result:
git 2.15.1
==> Upgrading git
==> Downloading https://homebrew.bintray.com/bottles/git-2.15.1.high_sierra.bottle.tar.gz
Error: curl is not executable
Warning: Bottle installation failed: building from source.
==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz
Error: curl is not executable
Strange. I use curl daily...
❯❯❯ curl
curl: try 'curl --help' or 'curl --manual' for more information
❯❯❯ which curl
/usr/bin/curl
❯❯❯ ls -al /usr/bin/curl
-rwxr-xr-x 1 root wheel 185104 Dec 1 15:45 /usr/bin/curl
So it exists and looks executable. Maybe the homebrew links got messed up? I will re-install curl using brew
❯❯❯ brew install curl
==> Downloading https://homebrew.bintray.com/bottles/curl-7.57.0.high_sierra.bottle.tar.gz
Error: curl is not executable
Warning: Bottle installation failed: building from source.
==> Downloading https://curl.haxx.se/download/curl-7.57.0.tar.bz2
Error: curl is not executable
So basically homebrew is not working for me. On TWO different machines running the same Mac OS version 10.13.2
NOTE: This is not limited in any way to installing git. The problem started trying to install minikube.
UPDATE
I checked my setup via brew config and noticed that although I DO have curl installed, homebrew does not see it: Curl: N/A
HOMEBREW_VERSION: 1.4.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: b4d43e950fd45c24e48d6ebfd3013357abcd21a9
Last commit: 10 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 809322678d0fb7ab034348f86f0e452eff203b49
Core tap last commit: 73 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_VISUAL: nano
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 9.0 build 900
Git: 2.14.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: N/A
Perl: /usr/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Java: 1.8.0_31
macOS: 10.13.2-x86_64
Xcode: 9.2
CLT: 9.2.0.0.1.1510905681
X11: 2.7.9 => /opt/X11
The OS already has curl installed, but homebrew does not see it.
I cannot install curl using homebrew (see above).
So now the problem becomes "How do I fix homebrew so it sees curl"?
I was running into the same issue yesterday. For me it was caused by a file called curl left over from a botched command in the same directory where I was running brew. Deleting that file resolved the issue.
I had same problem and I have no idea how but I fixed it. First I uninstalled any brew-version of curl that was installed. Then, when that didn't work, I navigated to \bin\usr\curl to make sure it was still there. I then ran curl in terminal (just literally `curl' and then which curl to make sure it was using right one), and then reran brew and it seemed to work. I think what happens is that for some reason in new Mac files sometimes don't appear locally until you open them for the first time when using iCloud. Its happened before with other dependencies, where I had to navigate to file and physically open it before it would be locally downloaded and be recognized as a dependency. Not sure if Mac does same thing with curl. If so, quite dumb.
I had this same issue, also on Mac OS High Sierra. I ended up running brew uninstall curl. This gave me an error, but then when I installed Homebrew curl again, it worked and I could install git and others.
if you have tried everything and nothing helps, if you're facing permissions issues - try to re-install the Homebrew:
uninstall:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
and then install it again:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
helped in my case

ruby "permission denied" installing/using homebrew cask

My wild bet is that this issue is somehow related to my base osx ruby setup... but as I'm not a ruby-ite, i need some guidance to discover more.
A couple days ago i tried to install a brew cask formula (several others were already installed previously). A couple weeks ago i upgraded to OSX Sierra.
Brew itself works perfectly, brew cask does not.
I get an "unexpected" error when I type brew cask by itself or with any subcommand:
Error: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ruby/st.h... yes
checking for st.h... yes
checking for rb_str_replace() in ruby.h... yes
creating Makefile
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `initialize': Permission denied - Makefile (Errno::EACCES)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `create_makefile'
from extconf.rb:24:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/msgpack-0.5.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/msgpack-0.5.8/gem_make.out
I've looked through many questions and tried many of the answers given, all to no avail.
Questions:
Homebrew cask option not recognized?
Failed to build gem native extension (installing Compass)
homebrew not working on OSX Can't install Brew
formulae correctly (Permission denied in /usr/local/lib)
OsX, can't use Homebrew because of Ruby permission
Attempts:
> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
> brew install ruby
Warning: ruby-2.4.0 already installed
> ls -l /System/Library/Frameworks/Ruby.framework/Versions/
drwxr-xr-x 7 root wheel 238 2017-01-12 12:12:13 2.0
lrwxr-xr-x 1 root wheel 3 2017-01-09 09:47:51 Current -> 2.0
> sudo chown -R $(whoami):admin /usr/local
> sudo chmod -R g+w /usr/local
> brew install caskroom/cask/brew-cask
> brew cask [list|cleanup|update|etc]
(gives error shown above)
Performed a complete homebrew uninstall, rm'ing extra dirs and files. Then complete homebrew re-install, followed by re-install many of the formulae I had previously.
Same commands above give same errors after reinstall.
Color me confused. 😕
So I just resolved something similar - it was a permissions issue for me. I ended up running:
sudo chown -R $(whoami) your-directory-here
on the Cask and caskroom directories - you may have to look around a little bit to find those directories on your system.

hourly cron messages re openssl cert usage error

A few days ago I was building a ruby app that had to use OpenSSL to access a web page. It kept failing to connect to the web site https://regex.alf.nu, so I went to stackoverflow and after much research I concluded that my OpenSSL was out of date at version 0.9.8zc. I made the recommended changes (the details of which are provided below) and after that my app was able to read the text of the web site mentioned above.
Today I discovered that my system has been generating an error mail message almost every hour since I made these changes (beginning Sun Apr 12 08:00:01). This is the text of the latest mail:
From SamShiffman#Samuels-MBP.PK5001Z Thu Apr 16 12:00:01 2015
X-Original-To: SamShiffman
Delivered-To: SamShiffman#Samuels-MBP.PK5001Z
From: SamShiffman#Samuels-MBP.PK5001Z (Cron Daemon)
To: SamShiffman#Samuels-MBP.PK5001Z
Subject: Cron <SamShiffman#Samuels-MBP> /usr/local/Cellar/openssl-osx-ca/1.0.4/bin/openssl-osx-ca /usr/local/bin/brew
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=SamShiffman>
X-Cron-Env: <USER=SamShiffman>
X-Cron-Env: <HOME=/Users/SamShiffman>
Date: Thu, 16 Apr 2015 12:00:01 -0700 (PDT)
Usage error; try -help.
rehash failed to verify, something is wrong
check /tmp/openssl-osx-ca.f9SEDVyI/cert.pem for problems
I haven't noticed any negative effects to my MBP, but I'm a little concerned that I may still have "broken" something the other day when I made those OpenSSL updates. As far as I can tell, the cron daemon error mails started after I ran these commands:
$ rvm osx-ssl-certs status all
>Certificates for /etc/openssl/cert.pem: Old.
>Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
$ rvm osx-ssl-certs update all
> Updating certificates for /etc/openssl/cert.pem: Updating certificates in '/etc/openssl/cert.pem'.
> Updated.
> Updating certificates for /usr/local/etc/openssl/cert.pem: Already up to date.
After this I still couldn't connect to the aforementioned web site. After more research I found a post in stackoverflow that referred to a tool as a possible fix. I ran:
$ brew tap raggi/ale
$ brew install openssl-osx-ca
>==> Installing openssl-osx-ca from raggi/homebrew-ale
>==> Downloading https://github.com/raggi/openssl-osx-ca/archive/1.0.4.tar.gz
>######################################################################## 100.0%
>==> make install PREFIX='/usr/local/Cellar/openssl-osx-ca/1.0.4' BREW='/usr/loca
==> Caveats
>To uninstall remove the openssl-osx-ca line from your crontab. e.g.
> (crontab -l | grep -v openssl-osx-ca) | crontab -
>==> Summary
>🍺 /usr/local/Cellar/openssl-osx-ca/1.0.4: 4 files, 16K, built in 2 seconds
$ git clone https://github.com/mislav/ssl-tools.git
$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.2a-1... 1543 symlinks created
$ brew install curl-ca-bundle
Error: No available formula for curl-ca-bundle
Searching formulae...
Searching taps...
$ ruby ssl-tools/doctor.rb
/Users/SamShiffman/.rvm/rubies/ruby-2.0.0-p598/bin/ruby (2.0.0-p598)
OpenSSL 1.0.2a 19 Mar 2015: /usr/local/etc/openssl
SSL_CERT_DIR=""
SSL_CERT_FILE=""
HEAD https://status.github.com:443
/Users/SamShiffman/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/openssl/buffering.rb:175:in `sysread_nonblock': end of file reached (EOFError)
$ ruby ssl-tools/doctor.rb 'regex.alf.nu'
/Users/SamShiffman/.rvm/rubies/ruby-2.0.0-p598/bin/ruby (2.0.0-p598)
OpenSSL 1.0.2a 19 Mar 2015: /usr/local/etc/openssl
SSL_CERT_DIR=""
SSL_CERT_FILE=""
HEAD https://regex.alf.nu:443
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
The server presented a certificate that could not be verified:
subject: /OU=Domain Control Validated/OU=PositiveSSL Wildcard/CN=*.alf.nu
issuer: /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA
error code 20: unable to get local issuer certificate
Possible causes:
`/usr/local/etc/openssl/certs/' is empty
$ rvm osx-ssl-certs status all
Warning! PATH is not properly set up, '/Users/SamShiffman/.rvm/gems/ruby-2.0.0-p598/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p598'.
Certificates for /etc/openssl/cert.pem: Up to date.
Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
After all this I still couldn't get the app to connect to the web site. I finally added this to my code (from a stackoverflow post) and it worked:
def get_html_string(url = #url)
uri = URI.parse(URI.encode(url.strip))
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body
end
Now it seems all the other steps I took leading up to this were unnecessary, but I don't know. At this point in the absence of any advice I would remove the openssl-osx-ca line from my crontab using:
(crontab -l | grep -v openssl-osx-ca) | crontab -
...but I'd like some confirmation from some code veterans who know more about this than I do.
Thank you
UPDATE 17Apr 11:00PDT
I upgraded brew, reinstalled openssl and recreated symlinks:
$ brew update
$ brew doctor
Binaries provided by keg-only formulae may override system binaries
with other strange results.
You may wish to `brew unlink` these brews:
openssl
$ brew reinstall openssl
$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.2a-1... 1543 symlinks created
$ brew upgrade
and the cron daemon mails stopped! Been rockin' 'n rollin' ever since.
I upgraded brew, reinstalled openssl and recreated symlinks:
$ brew update
$ brew doctor
Binaries provided by keg-only formulae may override system binaries
with other strange results.
You may wish to `brew unlink` these brews:
openssl
$ brew reinstall openssl
$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.2a-1... 1543 symlinks created
$ brew upgrade
and the cron daemon mails stopped! Been rockin' 'n rollin' ever since.

CocoaPod Mac Install Error

i want to install CocoaPods in Mac but all the time when i asked to install it i'm getting following statement please find below it.thanks for your advance
Last login: Fri Jul 18 11:45:00 on ttys000
venushkas-MacBook-Pro:~ venushka$ gem install cocoapods
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:213: warning: Insecure world writable dir /usr in PATH, mode 040777
This specific warning you've provided should not affect the installation of CocoaPods. If you'd like to silence it there are solutions to it from many other questions.
Just based on what you pasted you probably need to install CocoaPods with:
sudo gem install cocoapods
Because your using the system version of Ruby.

Missing the OpenSSL lib?

I have been trying to install ruby 2.1.1 but when I run it in the terminal, this is what i get:
$rbenv install 2.1.1
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /Users/nthulanemakgato/.rbenv/versions/2.1.1
Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140427221824.34053
Results logged to /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby- build.20140427221824.34053.log
Last 10 log lines:
io-console 0.4.2
json 1.8.1
minitest 4.7.5
psych 2.0.3
rake 10.1.0
rdoc 4.1.0
test-unit 2.1.1.0
installing rdoc: /Users/nthulanemakgato/.rbenv/versions/2.1.1/share/ri/2.1.0/system
installing capi-docs: /Users/nthulanemakgato/.rbenv/versions/2.1.1/share/doc/ruby
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
So I went on Google, searched and tried a few things like:
$brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.1f... Warning: Could not link openssl. Unlinking...
then i tried
$ brew update
error: unable to unlink old '.gitignore' (Permission denied) error: unable to create file CODEOFCONDUCT.md (Permission denied) error: unable to unlink old 'CONTRIBUTING.md' (Permission denied) error: unable to create file LICENSE.txt (Permission denied) error: unable to unlink old 'README.md' (Permission denied) error: unable to unlink old 'SUPPORTERS.md' (Permission denied) Checking out files: 100% (1995/1995), done. Error: Failure while executing: git pull - q origin refs/heads/master:refs/remotes/origin/master
$ brew upgrade ruby-build
Error: ruby-build not installed
and,
$brew install openssl
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl- 1.0.1g.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.1g.mavericks.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
The OpenSSL provided by OS X is too old for some software.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
Error: Failed to create: /usr/local/opt/openssl
Things that depend on openssl will probably not build.
==> Summary
🍺 /usr/local/Cellar/openssl/1.0.1g: 429 files, 15M
and lastly,
$sudo brew install openssl
Password:
Error: Cowardly refusing to `sudo brew install`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
and a couple of other things like(which details I won't go into unless you think its necessary):
$CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.1.1
$CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv install 2.1.1
and both haven't worked.
I have installed xcode
I have an OS X 10.9.2.
Homebrew is installed.
OpenSSL 0.9.8y 5 Feb 2013
I don't understand what's going on and I have been struggling with this for a long time, please help.
Let me know if there is more information that you need in order to help and i'll happily provide it.
I found the answer to this challenge in another site.
$rbenv install --patch 2.1.1
then
$curl https://gist.githubusercontent.com/andschwa/11334511/raw/563d5c2efb869cafb0c65404d12243822bba2817/ruby-2.1.1-readline.patch | rbenv install --patch 2.1.1
I got this information from this link:
https://schwartzmeyer.com/2014/04/26/building-ruby-2-0-0-and-2-1-1-on-os-x/

Resources