Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
whomwah opened this issue Jan 3, 2023 · 6 comments
Open

Comments

@whomwah
Copy link

whomwah commented Jan 3, 2023

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 (rbenv/ruby-build#2118 (comment)).

> 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
Copy link
Author

whomwah commented Jan 3, 2023

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
Copy link

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

@simon-caignart
Copy link

same problem here 😒

@kjayma
Copy link

kjayma commented Apr 24, 2023

@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
Copy link

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
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants