Big Sur - Ruby - Cannot load such file — Interrupted system call - ruby-on-rails

After upgrading to Big Sur I am getting errors running my Ruby server rotating through different files either with
cannot load such file --
or
Interrupted system call --
These errors rotate various files each time I run bundle exec rackup. I have tried uninstalling/reinstalling RVM, XCode Command Line Tools, and even tried switching to rbenv. Same outcome.
Any ideas?

It seems to get solved by uninstalling Kaspersky.
Also, it seems that the ruby applications are not the only ones facing this issue.
There are other security solutions too, eg. Avira.
https://github.com/rbenv/ruby-build/issues/1710
https://github.com/dart-lang/sdk/issues/44509

I was able to solve this problem for an rbenv ruby installation after noticing a similar-ish issue listed at the end of the ruby-build wiki. Adding MAKE_OPTS=-j1 finally worked, though it took much longer; The whole build ran with one process. The final command I used (though I don't know if calling ruby-build directly was necessary):
MAKE_OPTS=-j1 RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml)" \
ruby-build --verbose 2.6.6 ~/.rbenv/versions/2.6.6/
# to hook it up with rbenv:
rbenv rehash
I know this isn't your exact problem, but perhaps re-installing ruby would help.

Not a complete resolution yet, but we did find out that the issue seems specific to the newrelic-ruby-agent and have opened an issue (https://github.com/newrelic/newrelic-ruby-agent/issues/528) with them to do further investigation.
As a workaround, we are able to run locally by setting NEW_RELIC_AGENT_ENABLED=false in the env.list

Uninstalling Avira solved the problem I was having with rbenv install 3.0.0 on macOS 11.2. (See ruby-build #1710 (comment).) Thanks to #alex for the tip.

I got this error in brew install lima
this may not look like answer, but running up that command again and again brew install lima I kept getting different errors, I ran that command 7-8 times, and was able to finally install lima.

Related

Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib

When I try running rails console I get this error:
/Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require':
dlopen(/Users/TuzsNewMacBook/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/x86_64-darwin18/readline.bundle, 9):
Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
A quick search got me to this post and I've tried a few things:
brew reinstall postgresql (this is indeed the DB for this project)
and
cd /usr/local/opt/readline/lib
ln libreadline.8.0.dylib libreadline.6.2.dylib
(my version of readline is 8)
and
brew link readline --force
But none of these have fixed it.
I recently added pry-coolline, guard and guard-livereload gems to my project if that makes any difference (rails console loaded fine before those). I'm running on the latest macos.
(Update) I’m using pry rails as my rails console, if that makes any difference.
Any help? Thanks.
the error seems to be thrown when searching for /usr/local/opt/readline/lib/libreadline.7.dylib.
Have you tried to symlink that?
So something like:
cd /usr/local/opt/readline/lib
ln -s libreadline.8.0.dylib libreadline.7.dylib
Just tried that on macOS Mojave, ruby 2.5.3p105 and Rails 5.2.2 and worked.
Reinstalling my Ruby version seems to have fixed it:
rvm reinstall 2.3.7
can you try
cd /usr/local/opt/readline/lib
ln -s libreadline.8.dylib libreadline.7.dylib
you are on the right track but it seems like rails is looking for libreadline.7.dylib and libreadline.7.dylib is not there in the folder.
Yes, the best answer is to reinstall.
You can get the version easily by typing:
ruby -v
With rbenv, the command is i.e.:
rbenv install 2.3.7
with rvm:
rvm reinstall 2.3.7
A very simple solution that doesn't involve rebuilding your RVM gemset OR sym-linking libraries.
Add to your Gemfile:
gem 'rb-readline'
If you are doing bundler groups
group :development do
gem 'rb-readline'
end
Then run
> bundle
Let me know if that doesn't work.
Most often in Ruby-applications, this is caused by gems that have extensions (the gems saying "Building native extensions.."), that are built using a specific version of, in this case, readline.
Basically, there are two solutions:
Either, you can symlink version 8 of the gem, to the version missing. This will work in many cases, but if backwards compatibility is broken, it will not.
Or, if the gem actually supports version 8, you can reinstall that specific gem, or "pristine" it by running gem pristine --all.
EDIT: In scope of your "what I've tried", reinstalling PostgreSQL, is also one of the binaries, built using a specific version, that may also require a rebuild, to work with a system library, such as readline.
Got this issue:
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.4.dylib
doing...
cd /usr/local/opt/mpfr/lib/
ln -s libmpfr.dylib libmpfr.4.dylib
did the trick for me for macOS Catalina
Background: This has happened when I tried to install tig, but I think this is a common issue that you may have that you need to manually link the installed software into the right path that another software wants.
If you can not find readline installed on your Mac, you should run
brew install readline
After you installed deadline, brew will ask you to link it. But actually you can not link by running
brew link readline
Even you can not link by running
sudo brew link readline
Mac OS will warn you this is extremely dangerous and stop you to do.
The Latest version of readline is version 8, so you will see the error message like
Library not loaded: /usr/local/opt/readline/lib/libreadline.8.dylib
The brew installed deadline at
/usr/local/Cellar/readline/8.0.4
So you have to manually link it to the place that your software wants by using command ls
ln -s /usr/local/Cellar/readline/8.0.4 /usr/local/opt/readline
Enjoy!
So Ive checked a few answers here but I dont think they can work with a vanilla Mojave mac install. Im using 10.14.4 while I did these:
get homebrew from https://brew.sh
$ brew install coreutils : this installs the gnu coreutils pkg for mac, we want the greadlink from this because macOSX's readlink is not the same as the gnu readlink. Its extremely confusing but such is the life in macland.
$ echo 'alias readlink=greadlink' >> ~/.bash_aliases I found macs readlink to be a bit lacking so I overrode the existing readlink by aliasing greadlink. (you can make this usable by all users by $ alias readlink=greadlink >> /etc/bashrc which will enable every user to be able to use it.
$ ln -s /usr/local/opt/readline/lib/libreadline.8.dylib /usr/local/opt/readline/lib/libreadline.7.dylib I linked the already linked .8. file instead of '.8.0.' file because if it were to get updated to .8.1. then my readlink wont break or miss features on the library. Im pretty sure we will format our macs before 9+ comes out.
I would recommend against manually symlink'ing native libraries. Aas of OS X 10.4, the standard include library path /usr/include is no longer used and is locked by SIP (making it difficult to move things to).
Apple ships a “legacy installer” for you to be able to install the headers in the “old location”, which will also resolve your path to correctly find headers installed via brew.
cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop && open ~/Desktop/macOS_SDK_headers_for_macOS_10.14.pkg`
See here for a detailed write-up on what is going on.
My problem was just the same when running lftp.
Just running brew upgrade has solved my problem, as it has updated (among others):
readline 8.0.0_1 -> 8.0.1
lftp 4.8.4 -> 4.8.4_2

How to solve a RubyMine "'ruby-debug-ide' isn't installed" error

I get the error:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
but all gems were successfuly installed:
gem 'ruby-debug-ide'
gem 'debase'
I can run 'rdebug-ide' manually:
$ rdebug-ide
Using ruby-debug-base 0.2.1
Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine, or
the IntelliJ IDEA Ruby plugin. The command line interface to
ruby-debug is rdebug.
But when I start debugging, RubyMine asks to install the ruby-debug-ide gem. Why?
And, after installation I get:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
I'm running Mac OS X 10.11.3.
Here's the actual command that worked for me:
gem install ruby-debug-ide --pre
Complementing Ahsan Ellahi
In your terminal you're probably not running the same ruby version as inside Ruby Mine. You can check this
In Ruby Mine
Preferences --> Laguanges and Frameworks --> Ruby SDK and Gems
In Terminal
$ ruby -v
If you're not running the same version, try to set RubyMine to use the same Ruby version that you're running in your terminal. This should solve the problem. Than, if you really want to use another RubyVersion, you will need to go to your terminal, change the Ruby version and manually install both gems
I have faced this issue when debugging in a docker-compose environment. I suspect that RubyMine does not refresh the list of available gem after the SDK is added.
So if you add the SDK then add ruby-debug-ide to Gemfile you will get the error.
Instead, (re)create the SDK after adding ruby-debug-ide.
I started getting this after upgrading from 2017.x to 2018.1. In my case, it seems that RubyMine needed a newer version but its error message implied it couldn't find any version and failed to install it. I think it was trying to install it with a different SDK.
Manually installing the latest ruby-debugger-ide (in my case the --pre flag was necessary) and then restarting RubyMine did the trick for me.
Since you're using Mac OSX, I couldn't provide the same exact answer for you, but you can find a similar way of achieving this. I'm using Ubuntu with Vagrant, so you may need to adapt it just a little bit.
Copy the following gem from RubyMine/rb/gems app folder, please copy the gem related to your ruby runtime and platform, there are different gems for different ruby runtime and platforms, in my case, its:
debase-0.3.0.beta7.gem
ruby-debug-ide-0.8.0.beta6.gem
Install them inside your app host, in my case its vagrant, in your case it could be inside your container, or in your host OS using the following command:
gem install --force --local *.gem
Set breakpoint and start debugging.
It may asks you one more time to install the gem, but then the debug will works for sure.
This worked for me
gem install debase-ruby_core_source
Source: Cannot install Rubymine Debugger
You should look into RubyMine settings, which ruby version and which gemset (global/default) it is using. Check out where these required gems are installed and make sure RubyMine is using that gemset where these are installed successfully.
I fixed this after viewing the responses here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206072049-Cannot-start-debugger
The solution at the bottom suggested 'removing all my gems. removing ruby. cleaning up directories and rvm. removing ruby mine, then reinstalling everything'
I started with the easiest of these, which was to reinstall rubymine. That solved it for me.
I had this issue on Windows 11 running Ubuntu on WSL2. To solve, I manually copied the relevant files in my %AppData% directory into the corresponding directory in Ubuntu.
I found all the data at:
C:\Users[USER]\AppData\Local\JetBrains\RubyMine[VERSION]\ruby_stubs\[NUMBER]\home\[USER]\.gem\ruby\2.7.0
These files were copied to: \\wsl.localhost\Ubuntu\home\[USER]\.gem\ruby\2.7.0
After doing this, everything worked again.
I have faced this issue too with Rubymine 8, rvm 1.29.1 and Ruby version 2.3.3 And upgrading the Rubymine version from Rubymine 8 to Rubymine 2016.3 or latest resolves the issue for me.
Check ruby SDK's version is right.You can first using rails installer to install everything .
Then using gem to install rdebug for ruby 2+.
Make sure Rubymine's Ruby version is same to which you have installed.With those all done,you will be able to debug ruby.
Please check x286 vs 64 version, both Ruby and Rmine version. I had this problem runnin x86 rubyMine on 64 ruby
A combination of matching the host ide ruby version with the remote SDK version worked for me but required a few additional steps. I too am running mac os as my host (running mohave)
the remote environment setup in preferences -> ruby sdk and gems must have the same version as the remote target, including any gems installed.
NOTE: I had to re-install the bundler gem on both host and remote host to get the gem manager to install things auto-majically.
the project environment must be changed to use the same version as the remote host as well. this is in File -> preferences for new projects -> ruby sdk and gems.
NOTE: I also had to set the default RVM on my local host and remote host and unset the previous version as default in the local host preferences.
Once I did this I was able to get gems in sync and remote debugger to connect.
My solution was to go to Rubymine settings, to the available SDKs,
remove the SDK, restart Rubymine and add the SDK again.
Running Ubuntu 18 something, RubyMine version 2020.3. Had this issue. None of these suggestions worked for me, same error no matter what did. I was using RVM, and ruby 2.6 and 2.7, switched back and forth a cleaning and reinstalling gems along thew way, both debase and ruby-debug-ide were installed according to the gem list. Settings in rubymine matched "ruby -v" from the command line. VSCode worked perfectly with this setup.
In the end i removed RVM and all the ruby versions, installed ruby via rbenv, installed ruby 2.6.5 and that worked like a charm.
I think this error is generated for multiple reasons with no real way to figure out which reason for your specific instance. I would like to encourage jetbrains to generate more debug information on errors like this, or if you are generating error information, point out where it is when this happens.
Try these steps:
1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. brew install ruby
3. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
if you get unshallow error on any step then first try:
1. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
2. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
3. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4. brew install ruby
5. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
Lastly restart the terminal and check .bash_profile:
- nano ~/.bash_profile
If you see the path variable, just close it. Otherwise it means something went wrong :/.
The last step is to open
RubyMine -> Preferences -> Language and Frameworks -> Ruby SDK and Gems -> select the newest ruby version and apply.
You may need to update ruby version from the gemfile.
And it should be done!

Butchered Ruby on Rails Installation

So first off, this is my first post on stackoverflow, so take it easy on me ;)
I'm a new Fedora user (f20) and I'm still in the early stages of getting used to linux. I tried to install Ruby on Rails (newest Ruby—2.1.1—and newest rails—4.1.0), using several guides I found online, which required for me to download and install several other packages. Several errors occurred towards the end of my installation so I thought I'd uninstall it and start from scratch using RVM which I hadn't done in the first place.
I tried removing the gems I installed using gem uninstall [gem_name] but I wasn't having any luck with many of them. So I decided to just sudo yum remove ruby in the hopes it would remove everything I had installed, but to my dismay the directory /usr/share/ruby still exists which makes me think that my uninstallation was incomplete.
Is there some why to completely remove any shred of ruby, rails, and gems from my computer so I can reinstall ruby on rails? Is it even necessary for me to do so in order to install a lower version of ruby (2.1.0)?
Thanks in advance.
Ok, after reading the comments I figured out the problem!
I ran a yum list | grep ruby and similar searches and found that I had not, contrary to what I believed, removed all the packages I had installed. After deleting the remaining packages my usr/share/ruby folder vanished to the sound of my yipee's!
Thanks

Problems finding ruby, rails, git after bungled PostgreSQL install

I had rails working fine for several weeks but I tried to install PostgreSQL to match Heroku and it failed to work. Now, when I open the terminal it pretend rails is not there and sets the default ruby to 1.8.7. When I start RVM it finds the right version of ruby and finds rails again and can start the server but each time I open a new shell it's back to not finding anything. Plus, the git commands don't work even after starting rvm.
I have set rvm to start by default but that doesn't work either, it has to be started manually, and it still doesn't fix the git issue.
More Detail
I am installing on Mountain Lion. This already has Postgres but the tutorial I was using suggested installing fresh using Homebrew. The trouble was the Homebrew installation installs to /usr/local/var/postgres and the installed ppstgres installs to usr/var/postgres. The system automatically uses the usr/var/postgres version, so following the tutorial I chnaged the order of usr/local/bin and usr/bin in etc/paths. That didn't help so I changed it back. Everything then went to hell so I reinstalled Mountain Lion but nothing had changed.
There are two known problems with loading RVM & default ruby:
login shell: go to terminal emulator preferences and enable login shell, sometimes it might be required to use /bin/bash --login instead.
ZSH (+ Oh-My-ZSH): go to ~/.zshrc and comment out any lines starting with: PATH= or path=(, it is still possible to use those but they need to reference itself like: PATH=$PATH:HOME/.rvm/bin or path+=( $HOME/.rvm/bin ) - which update and not reset PATH. This might be a bug in terminal emulator or ZSH ...
The git issue is explained by the reinstall of Mountain Lion which did not automatically install the command line tools. That now works. The only pain is having to load rvm every time now.

Getting a "bad interpreter" error when using brew

I'm getting this error when I try to run any brew command.
Holger-Sindbaeks-MacBook-Air:~ holgersindbaek$ brew help
-bash: /usr/local/bin/brew: /usr/bin/ruby: bad interpreter: No such file or directory
I have absolutely no idea on how to fix this and been searching for a long time without answer.
I got this error (much the same):
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 26: /usr/local/Library/brew.rb: Undefined error: 0
and fixed by the solution below:
Open brew.rb:
$ sudo vim /usr/local/Library/brew.rb
Change the first line's 1.8 to Current:
Before:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
After:
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
Then brew works for me. Hope it helps if any other one got this issue. :)
If you get the error
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
change the MACOS check from <10.5 to <10.
Tip by #TimCastelijns:
10.5 doesn't work because in comparison, it's higher than 10.10 (.1 vs .5). I added a check (and MACOS_VERSION != 10.10) instead of lowering from 10.5 to 10.
What you are getting means that Homebrew has not been able to locate the Ruby interpretter at the specified location.
Install Apple Developer Kit (comes with Xcode) which should be available to you as an optional install (or you can simply download it from Apple). This will install the Ruby interpreter for you.
In case you already have Xcode installed, this means that one of these things is happening:
You have a broken Ruby installation
You have more than one Ruby installation
Your installation has not been configured properly.
To identify if this is the first case, you can run ruby and see if you get any response.
If you don't, your installation is broken and you need to reinstall it. If you do, you then run which ruby. This should give you the absolute path to your Ruby executable. If this is anything other than /usr/bin/ruby then homebrew (and a bunch of other programs) will not be able to find it.
In case you have not ever tampered with your Ruby installation, you can check to see if /usr/bin/ruby already exists or not: cat /usr/bin/ruby. If you get No such file or directory, then you can easily create a symbolic link to your Ruby installation. Assuming the output of which ruby to by /usr/local/bin/ruby, you create the symbolic link this way: sudo ln -s /usr/local/bin/ruby /usr/bin/ruby and all should be well.
If there is a file at that location, you can run file /usr/bin/ruby to see if it's a real file, a symbolic link, or a corrupted file. If it is a symbolic link, your installation should be working, and since it's not, it probably is either a corrupted symlink or it's a bogus file.
You can remedy that by first deleting it (sudo rm /usr/bin/ruby) and then creating a new symlink to the correct location (sudo ln -s /usr/local/bin/ruby /usr/bin/ruby).
If non of the above works, you should consult the homebrew team after a clean install of Xcode and removing any traces of a Ruby installation on your system.
EDIT
Alternatively, as pointed out by the other answers, the issue might be because of a bad ruby version in your Homebrew settings.
A quick fix might be updating your Homebrew:
cd /usr/local
git pull -q origin refs/heads/master:refs/remotes/origin/master
If this does not help, you might want to get your hands dirty and manually fix the problem by:
Editing brew.rb from /user/local/Library/brew.rb
Changing /1.8/ to /Current/ in the first line, which will cause the hashbang to point to the current Ruby version as the executor
If this does not help, either, you can also modify the MACOS check and change it from 10.5 to 10 to avoid the infamous "Homebrew requires Leopard or higher" error.
DISCLAIMER
A bunch of thanks to other contributors in the answers below and their commenters. I am not committing plagiarism, simply aggregating the answers into one integrated article to help others.
Fix:
sudo gem install cocoapods
At the risk of oversimplifying things, try running
gem install bundler
I was transitioning my Ruby environment from RBENV to RVM and it worked for me.
This happened because I needed to update brew - in the updated version it already uses Current ruby
cd /usr/local
git pull -q origin refs/heads/master:refs/remotes/origin/master
This solved the problem
You need to change the path for Ruby.Framework
I solved it with commands as mentioned.
brew install cocoapods --build-from-source
brew link --overwrite cocoapods
If you have a lower version below Xcode 11, you have to remove it before you use the above commands.
Reference: Ruby Framework issue
None of the above worked for me, so I kept browsing and found this answer,
https://stackoverflow.com/a/24225960/1359088
which did fix brew for me. He says in step 1 to install XCode 6 command line tools, but doesn't say how; use this command:
xcode-select --install
I got the same issue when updated to MacOSX High Sierra & using Xcode 9 with that. High Sierra update ruby gem to version 2.3 but xcpreety command of Xcode 9 still using Ruby 2.0 which is unable to find now & gives bad interpreter.
Just go to Terminal & run
sudo gem install xcpretty
Restart Xcode & do fresh clean build it works for me.
Hope it helps!!!
After upgrading to macOS High Sierra, get it fixed with following commands:
sudo gem install cocoapods
In my case seems like fastlane installed incorrectly with brew install fastlane system didn't write correct path to fastlane. I fixed it with alias fastlane=~/.fastlane/bin/fastlane
I solved it with commands as mentioned.
1.) Uninstall your GEM.
gem unistall GEM
2.) Then Install your GEM.
sudo gem install GEM -n /usr/local/bin
I got bad interpreter: No such file or directory error when used xcpretty and xcpretty-travis-formatter on upgraded MacOS.
To solve it
gem install xcpretty
gem install xcpretty-travis-formatter
That is why I can recommend you to reinstall failed component gem install <name>
#For example error looks like
/usr/local/bin/xcpretty-travis-formatter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
#use
gem install xcpretty-travis-formatter

Resources