-1

I am trying to use a org-roambibtexwhich in it's documentary needs also a package wirtten in Ruby, the package itself is calledanystyle-cli`, the github page is here. The package can be installed from RubyGem but when I tried to run through it I run into the following error:

gem install anystyle --user-install                                                                                                                                    ✔  at 11:59:33 
WARNING:  You don't have /Users/zhouqiaohui/.gem/ruby/2.6.0/bin in your PATH,
      gem executables will not run.
Building native extensions. This could take a while...
ERROR:  Error installing anystyle:
    ERROR: Failed to build gem native extension.

    current directory: /Users/zhouqiaohui/.gem/ruby/2.6.0/gems/wapiti-2.0.0/ext/wapiti
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 extconf.rb
checking for -lpthread... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
    --with-pthreadlib
    --without-pthreadlib
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:789:in `try_func'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1016:in `block in have_library'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1011:in `have_library'
    from extconf.rb:20:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/zhouqiaohui/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/wapiti-2.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/zhouqiaohui/.gem/ruby/2.6.0/gems/wapiti-2.0.0 for inspection.
Results logged to /Users/zhouqiaohui/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/wapiti-2.0.0/gem_make.out

In fact, at first, my error is : You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

In order to solve the problem, I reinstalled ruby from homebrew and did the following the suggestion from here, but afterward, when I tried to run the command again I am encountering the problem I just showed.

I looked into the path ~/.gen/ruby/2.6.0 and saw there's no bin folder so I created it manually and rerun the command, the error persists.


I found a solution that works for macos:https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/

JoZ
  • 201
  • 2
  • 13

1 Answers1

1

I think this is the most important part of the error message:

You have to install development tools first.

Installing the developer tools on a Mac can be done with this command:

xcode-select —install

When you get the error command line tools are already installed, use "Software Update" to install updates when trying to install the developer tools. Then they are already installed and need to be updated. This usually happens each time after an macOS upgrade. To update the developer tools, choose System Settings from the Apple menu  in the corner of your screen. Then click General in the sidebar, and Software Update on the right. Or choose System Preferences. Then click Software Update.

spickermann
  • 100,941
  • 9
  • 101
  • 131
  • I installed it as well. – JoZ Nov 02 '22 at 19:50
  • this is what I have got after I typed in `xcode-select --install`:xcode-select: error: command line tools are already installed, use "Software Update" to install updates – JoZ Nov 02 '22 at 19:53
  • Then you need to update the developer tools using "Software Update" on your Mac. I added a short description to my answer. – spickermann Nov 03 '22 at 05:48