TaKO8Ki / frum

A little bit fast and modern Ruby version manager written in Rust
MIT License
628 stars 15 forks source link

Struggling to install Ruby 3.2 on M1 mac - cannot load such file -- psych #126

Open whomwah opened 1 year ago

whomwah commented 1 year ago

Morning,

I'm unable to install 3.2 on my M1 mac this morning. I've tried various ruby-build solutions with no luck. I think the project doesn't use ruby-build though.

Here's my output when making sure libyaml is installed too (https://github.com/rbenv/ruby-build/discussions/2118#discussioncomment-4505182).

> brew install libyaml
...
> brew --prefix libyaml
/opt/homebrew/opt/libyaml
> frum install 3.2.0
==> Downloading https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0.tar.xz
==> Extracting ruby-3.2.0.tar.xz
==> Building Ruby 3.2.0
error: Can't build Ruby: make failed: . ./vm_opts.h
yaml.h not found
/Users/duncan/.frum/versions/.downloads/.tmptqJwcH/ruby-3.2.0/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych

run with --debug for full backtrace
make: *** [rdoc] Error 1

Anyone have any tips? Do I need to use a RUBY_OPTS explicitly to point to libyaml

whomwah commented 1 year ago

Also tried:

❯ frum install 3.2.0 --with-libyaml-source-dir=$(brew --prefix libyaml)
==> Downloading https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0.tar.xz
==> Extracting ruby-3.2.0.tar.xz
==> Building Ruby 3.2.0
error: Can't build Ruby: make failed: . ./vm_opts.h
/Users/duncan/.frum/versions/.downloads/.tmpOQPawU/ruby-3.2.0/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych

run with --debug for full backtrace
make: *** [rdoc] Error 1
VladimirHorky commented 1 year ago

@whomwah Have you found out where is the problem? I have same issue :(

simon-caignart commented 1 year ago

same problem here 😒

kjayma commented 1 year ago

@whomwah This worked for me (see apple.stackexchange):

$ export CPATH=/opt/homebrew/include
$ export LIBRARY_PATH=/opt/homebrew/lib

Still trying to sort out the panic issue when using the --with-jemalloc option.

chaameliiia commented 7 months ago

i've solved this problem as below:

  1. Set the env variables for C/C++ libraries in ~/.zprofile (reference: apple.stackexchange.com)
    export CPATH=$(brew --prefix)/include
    export LIBRARY_PATH=$(brew --prefix)/lib
  2. Set the Ruby configuration options env variable in ~/.zprofile (reference: asdf-ruby/issues/328)
    export RUBY_CONFIG_OPTIONS=--with-openssl-dir=$(brew --prefix openssl@3)
  3. Install the Ruby
    frum install {version} $RUBY_CONFIG_OPTIONS

though, i think this is just a temporary workaround.

my dev environment:

System:
  OS: macOS 14.2.1
  CPU: (8) arm64 Apple M2
  Memory: 114.20 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn:
    version: 4.0.2
    path: ~/.nvm/versions/node/v20.10.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/chaameliiia/.gem/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 3.3.0
    path: /var/folders/nh/63c12hhn7tvc51n087xly8lh0000gn/T/frum_45902_1704321376181/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
JulianDicken commented 3 months ago

For me the ''proper'' fix that didn't involve messing around involved installing pkg-config before attempting to install ruby. brew install pkgconfig Hope that helps someone, sorry for the necro :)