Downloading ruby-2.2.0.tar.bz2...
-> https://cache.ruby-china.com/pub/ruby/2.2/ruby-2.2.0.tar.bz2
Installing ruby-2.2.0...
WARNING: ruby-2.2.0 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.0 using ruby-build 20211019)Inspect or clean up the working tree at /var/folders/3y/5k7bvzg94b50d250zfzxxjqr0000gn/T/ruby-build.20211027143056.14917.1CNSu3
Results logged to /var/folders/3y/5k7bvzg94b50d250zfzxxjqr0000gn/T/ruby-build.20211027143056.14917.log
Last 10 log lines:
0.00% documented
Elapsed: 0.0s
config.status: creating -darwin21-fake.rb
rm: illegal option -- a
usage: rm [-f | -i][-dPRrvW] file ...
unlink file
config.status: error: could not create -darwin21-fake.rb
make: *** [-darwin21-fake.rb] Error 64
解决方法
1234567891011121314
$ cd /var/folders/3y/5k7bvzg94b50d250zfzxxjqr0000gn/T/ruby-build.20211027143056.14917.1CNSu3/ruby-2.2.0/
$ vim config.status
# 找到下面的代码(1097行)*) rm -f "$ac_file"&& mv "$ac_tmp/out""$ac_file"# 改成,将 rm -rf "$ac_file" 去掉*) mv "$ac_tmp/out""$ac_file";;# 再编译 2.2.0 安装成功$ make && make install
This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/grant/.rbenv/versions/2.2.0/bin/ruby -r ./siteconf20211027-40423-oo5tbo.rb extconf.rb --with-iconv-dir=/opt/homebrew/opt/libiconv
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
-----
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions. If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More DeveloperTools" to open the developer site, download the installer for your OS
version and run it.
-----
*** 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=/Users/grant/.rbenv/versions/2.2.0/bin/$(RUBY_BASE_NAME) --help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.Backtrace for gem load error is:/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs/runtimes.rb:48:in `autodetect'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs.rb:5:in `<module:ExecJS>'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs.rb:4:in `<top (required)>'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/uglifier-2.7.2/lib/uglifier.rb:3:in `require'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/uglifier-2.7.2/lib/uglifier.rb:3:in `<top (required)>'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `require'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require'/Users/grant/projects/launchapp/config/application.rb:8:in `<top (required)>'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'/Users/grant/projects/launchapp/bin/rails:8:in `require'/Users/grant/projects/launchapp/bin/rails:8:in `<top (required)>'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client/rails.rb:28:in `load'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client/rails.rb:28:in `call'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client/command.rb:7:in `call'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client.rb:28:in `run'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/bin/spring:49:in `<top (required)>'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `load'/Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `<top (required)>'/Users/grant/projects/launchapp/bin/spring:13:in `require'/Users/grant/projects/launchapp/bin/spring:13:in `<top (required)>'bin/rails:3:in `load'bin/rails:3:in `<main>'Bundler Error Backtrace: from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:80:in `block (2 levels) in require' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require' from /Users/grant/projects/launchapp/config/application.rb:8:in `<top (required)>' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>' from /Users/grant/projects/launchapp/bin/rails:8:in `require' from /Users/grant/projects/launchapp/bin/rails:8:in `<top (required)>' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client/rails.rb:28:in `load' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client/rails.rb:28:in `call' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client/command.rb:7:in `call' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/client.rb:28:in `run' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/bin/spring:49:in `<top (required)>' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `load' from /Users/grant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `<top (required)>' from /Users/grant/projects/launchapp/bin/spring:13:in `require' from /Users/grant/projects/launchapp/bin/spring:13:in `<top (required)>' from bin/rails:3:in `load' from bin/rails:3:in `<main>'