Open bartoszmaka opened 3 years ago
Not sure. I don't know that asdf-ruby or ruby-build (which it asdf-ruby uses) have gotten much use on Big Sur yet.
Currently, the asdf-ruby plugin references an old ruby-build tag (which uses an old openssl version; we need openssl-111i https://github.com/rbenv/ruby-build/commit/bad7a7c0b4833f44cf653e7107f0e19e209bfe2e). I had to manually update the tag to be able to install Ruby on Apple M1:
.asdf/plugins/ruby master ✗
▶ git diff
diff --git a/lib/utils.sh b/lib/utils.sh
index 43c4409..ab81fab 100644
--- a/lib/utils.sh
+++ b/lib/utils.sh
@@ -1,4 +1,5 @@
-RUBY_BUILD_VERSION="${ASDF_RUBY_BUILD_VERSION:-v20201208}"
+# RUBY_BUILD_VERSION="${ASDF_RUBY_BUILD_VERSION:-v20201208}"
+RUBY_BUILD_VERSION="${ASDF_RUBY_BUILD_VERSION:-v20201210}"
With that, installing Ruby should work now:
▶ asdf list ruby
2.7.2
▶ which ruby
/Users/sohooo/.asdf/shims/ruby
▶ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
I ran into a problem installing ruby 2.6.6 (not 2.6.5) on Big Sur / 2020 MacBook Air (M1 / apple silicon). I tried every which way with openssl to no avail.
Found this comment in ruby-build
issues:
santostiago commented on Jan 18 I ended up doing this: export optflags="-Wno-error=implicit-function-declaration"; export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"; export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"; export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" | rbenv install 2.5.5
export optflags="-Wno-error=implicit-function-declaration"
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
asdf install ruby 2.6.6
(fish shell version)
set -gx optflags "-Wno-error=implicit-function-declaration"
set -gx LDFLAGS "-L/opt/homebrew/opt/libffi/lib"
set -gx CPPFLAGS "-I/opt/homebrew/opt/libffi/include"
set -gx PKG_CONFIG_PATH "/opt/homebrew/opt/libffi/lib/pkgconfig"
asdf install ruby 2.6.6
if that doesn't work, let me know --I tried a bunch of things before I got there
What things did you try before this? I presume I need one of those preceding steps. I am still failing. Big Sur (not M1) ruby 2.6.5
@rpdecks
sorry, these notes are a little rough:
let's try rbenv instead, first removing legacy_version_file = yes
from .asdfrc
brew uninstall rbenv
@edmangimelli you're the best. That was helpful. Who keeps notes like that?? Attempting to good citizen in response... I'm circling back here to note what worked for me.
brew uninstall --ignore-dependencies readline
brew uninstall --ignore-dependencies openssll
rm -rf /opt/homebrew/etc/openssl@1.1
rm -rf /opt/homebrew/etc/openssl@1.1/cert.pem
rm -rf /opt/homebrew/etc/openssl@1.1/certs
rm -rf /opt/homebrew/etc/openssl@1.1/ct_log_list.cnf
rm -rf /opt/homebrew/etc/openssl@1.1/ct_log_list.cnf.dist
rm -rf /opt/homebrew/etc/openssl@1.1/misc
rm -rf /opt/homebrew/etc/openssl@1.1/misc/CA.pl
rm -rf /opt/homebrew/etc/openssl@1.1/misc/tsget
rm -rf /opt/homebrew/etc/openssl@1.1/misc/tsget.pl
rm -rf /opt/homebrew/etc/openssl@1.1/openssl.cnf
rm -rf /opt/homebrew/etc/openssl@1.1/openssl.cnf.dist
rm -rf /opt/homebrew/etc/openssl@1.1/private
brew install -s readline
brew install -s ruby-build
asdf install ruby 2.6.5
=> PROFIT!!
I did not set all those flags this time around but I did try that earlier before all the readline
and openssl
business... so perhaps that is still necessary? I use ZSH shell but foolishly typed it all in using the fish syntax... anyhow?
Took me a long day to try the different suggestions, could get ruby 2.6.5, 2.6.7, 3.0.1 compiled, with both asdf and rbenv.
But....
Still looking for a way to run rails server or console, all the rubies bring me the same ffi errors:
1: from /Users/juju/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.9.18/lib/ffi/library.rb:535:in
find_type'
/Users/juju/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.9.18/lib/ffi/types.rb:69:in find_type': unable to resolve type 'size_t' (TypeError)
Found a comment of a guy saying:
I got an error from ffi as well on M1. What solved for me was to run bundle update ffi -- --disable-system-libffi
but this doesn't work, raising an error
Could not find gem '--disable-system-libffi'.
For those who could successfully compile rubies, could you actually run rails with them ?
Found a comment of a guy saying:
I got an error from ffi as well on M1. What solved for me was to run bundle update ffi -- --disable-system-libffi
but this doesn't work, raising an error
Could not find gem '--disable-system-libffi'.
For those who could successfully compile rubies, could you actually run rails with them ?
I'm not seeing this exact error, but I had a similar chain of issues (Ruby wouldn't install; fixed by overriding library path but then FFI didn't work). What worked for me is bundle config build.ffi --disable-system-libffi
then bundle update ffi
.
You might need to gem uninstall ffi
first.
@edmangimelli you're the best. That was helpful. Who keeps notes like that?? Attempting to good citizen in response... I'm circling back here to note what worked for me.
brew uninstall --ignore-dependencies readline brew uninstall --ignore-dependencies openssll rm -rf /opt/homebrew/etc/openssl@1.1 rm -rf /opt/homebrew/etc/openssl@1.1/cert.pem rm -rf /opt/homebrew/etc/openssl@1.1/certs rm -rf /opt/homebrew/etc/openssl@1.1/ct_log_list.cnf rm -rf /opt/homebrew/etc/openssl@1.1/ct_log_list.cnf.dist rm -rf /opt/homebrew/etc/openssl@1.1/misc rm -rf /opt/homebrew/etc/openssl@1.1/misc/CA.pl rm -rf /opt/homebrew/etc/openssl@1.1/misc/tsget rm -rf /opt/homebrew/etc/openssl@1.1/misc/tsget.pl rm -rf /opt/homebrew/etc/openssl@1.1/openssl.cnf rm -rf /opt/homebrew/etc/openssl@1.1/openssl.cnf.dist rm -rf /opt/homebrew/etc/openssl@1.1/private brew install -s readline brew install -s ruby-build asdf install ruby 2.6.5 => PROFIT!!
I did not set all those flags this time around but I did try that earlier before all the
readline
andopenssl
business... so perhaps that is still necessary? I use ZSH shell but foolishly typed it all in using the fish syntax... anyhow?
This solution didn't work on macOS 12.6
+ ruby-build 20221004
This solution didn't work on
macOS 12.6
+ruby-build 20221004
Not supported on macOS 13.0
either (ruby-build 20221101
).
Unfortunately, this is it.
Ruby 2.6.X is outdated
, so don’t expect the situation to change.
Ruby 2.6 reached the end of life in March 2022
. Upgrading to 2.7.X
is the recommended approach, and it might not be as complicated as you might think.
I assume you are using the M1 chip on your machine. I've wrote a SO post about this that might help you get it running https://stackoverflow.com/questions/69012676/install-older-ruby-versions-on-a-m1-macbook/69012677#69012677
brew uninstall --ignore-dependencies readline
So I'm trying to figure out how to solve this same problem in OS Ventura and clearly something has changed in the last couple of years with regards to where Homebrew is now located. It is no longer in /opt/Homebrew
I finally solved my situation with:
brew uninstall libffi
brew install libffi
set -gx LDFLAGS "-L/usr/local/opt/libffi/lib"
set -gx CPPFLAGS "-I/usr/local/opt/libffi/include"
asdf install ruby 2.6.10
I'm using an Intel mac.
I ran into a problem installing ruby 2.6.6 (not 2.6.5) on Big Sur / 2020 MacBook Air (M1 / apple silicon). I tried every which way with openssl to no avail.
Found this comment in
ruby-build
issues:santostiago commented on Jan 18 I ended up doing this: export optflags="-Wno-error=implicit-function-declaration"; export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"; export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"; export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" | rbenv install 2.5.5
Here's what I did:
export optflags="-Wno-error=implicit-function-declaration" export LDFLAGS="-L/opt/homebrew/opt/libffi/lib" export CPPFLAGS="-I/opt/homebrew/opt/libffi/include" export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" asdf install ruby 2.6.6
(fish shell version)
set -gx optflags "-Wno-error=implicit-function-declaration" set -gx LDFLAGS "-L/opt/homebrew/opt/libffi/lib" set -gx CPPFLAGS "-I/opt/homebrew/opt/libffi/include" set -gx PKG_CONFIG_PATH "/opt/homebrew/opt/libffi/lib/pkgconfig" asdf install ruby 2.6.6
if that doesn't work, let me know --I tried a bunch of things before I got there
This also worked for me to install 2.6.5
After update to Big Sur, the ruby 2.6.5 won't compile.
asdf install ruby 2.6.5
returns the following output:Those are last lines from compilation log:
The same issue occurs with ruby 2.7.2, and ruby 2.6.5 installed via
rvm