This page looks best with JavaScript enabled
⚠️

【XCode】XCodeがぶっ壊れていたのでアップデート?する

 ·   ·  ☕ 3 分で読めます
✏️

bundle installgem install racc -v '1.5.2'でエラーが出て、XCodeが壊れていたので修復したのでその過程を記録します。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
$ bundle install
Fetching gem metadata from https://rubygems.org/.......
Using rake 13.0.1
Using concurrent-ruby 1.1.7
Using i18n 1.8.5
Using minitest 5.14.2
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using activesupport 5.2.4.4
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.5.0
Fetching racc 1.5.2
Installing racc 1.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/k_end/personal/hashlog/vendor/bundle/ruby/2.6.0/gems/racc-1.5.2/ext/racc/cparse
/Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/bin/ruby -I /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20210129-55007-1tywqld.rb extconf.rb
checking for rb_ary_subseq()... *** 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/k_end/.anyenv/envs/rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
/Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/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 /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:331:in `open'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:331:in `open'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'
        from extconf.rb:6:in `<main>'

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

  /Users/k_end/personal/hashlog/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-19/2.6.0/racc-1.5.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/k_end/personal/hashlog/vendor/bundle/ruby/2.6.0/gems/racc-1.5.2 for inspection.
Results logged to /Users/k_end/personal/hashlog/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-19/2.6.0/racc-1.5.2/gem_make.out

An error occurred while installing racc (1.5.2), and Bundler cannot continue.
Make sure that `gem install racc -v '1.5.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 5.2.4.4, which depends on
    actioncable was resolved to 5.2.4.4, which depends on
      actionpack was resolved to 5.2.4.4, which depends on
        actionview was resolved to 5.2.4.4, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri was resolved to 1.11.1, which depends on
              racc
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$ gem install racc -v '1.5.2'
Building native extensions. This could take a while...
ERROR:  Error installing racc:
        ERROR: Failed to build gem native extension.

    current directory: /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/racc-1.5.2/ext/racc/cparse
/Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/bin/ruby -I /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20210130-55949-tzcbjo.rb extconf.rb
checking for rb_ary_subseq()... *** 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/k_end/.anyenv/envs/rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
/Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/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 /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:331:in `open'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:331:in `open'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
        from /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'
        from extconf.rb:6:in `<main>'

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

  /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/racc-1.5.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/racc-1.5.2 for inspection.
Results logged to /Users/k_end/.anyenv/envs/rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/racc-1.5.2/gem_make.out

You have to install development tools first.

確認するとXCodeが壊れていたので、一旦アプリケーションからゴミ箱にぽい。

More Software Downloads - Apple Developerから12.4をインストール。

image.png
アプリケーションからちゃんと起動できる状態にする。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$ codebuild -license
xcrun: error: active developer path ("/Applications/Xcode-beta.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.

$ sudo xcode-select --switch path/to/Xcode.app
Password:
xcode-select: error: invalid developer directory 'path/to/Xcode.app'

# パス調べずにそのまま打ち込むポカをしたので
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Password:

$ xcodebuild -license
Xcode and Apple SDKs Agreement

PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE USING THE APPLE SOFTWARE OR APPLE SERVICES.  THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE.  IF YOU AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS, CLICK THE “AGREE” BUTTON.  BY CLICKING “AGREE” OR BY DOWNLOADING, USING OR COPYING ANY PART OF THIS APPLE SOFTWARE OR USING ANY PART OF THE APPLE SERVICES, YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW.  IF YOU DO NOT OR CANNOT AGREE TO THE TERMS OF THIS AGREEMENT, YOU CANNOT USE THIS APPLE SOFTWARE OR THE APPLE SERVICES.  DO NOT DOWNLOAD OR USE THIS APPLE SOFTWARE OR APPLE SERVICES IN THAT CASE.

1.      Definitions
Whenever capitalized in this Agreement:
...

Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

$ sudo xcodebuild -license
Xcode and Apple SDKs Agreement

PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE USING THE APPLE SOFTWARE OR APPLE SERVICES.  THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE.  IF YOU AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS, CLICK THE “AGREE” BUTTON.  BY CLICKING “AGREE” OR BY DOWNLOADING, USING OR COPYING ANY PART OF THIS APPLE SOFTWARE OR USING ANY PART OF THE APPLE SERVICES, YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW.  IF YOU DO NOT OR CANNOT AGREE TO THE TERMS OF THIS AGREEMENT, YOU CANNOT USE THIS APPLE SOFTWARE OR THE APPLE SERVICES.  DO NOT DOWNLOAD OR USE THIS APPLE SOFTWARE OR APPLE SERVICES IN THAT CASE.
...

By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] agree # agreeを入力する

You can view the license agreements in Xcode's About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf
1
2
3
4
5
6
7
$ gem install racc
Building native extensions. This could take a while...
Successfully installed racc-1.5.2
Parsing documentation for racc-1.5.2
Installing ri documentation for racc-1.5.2
Done installing documentation for racc after 1 seconds
1 gem installed

xcode-selectによるデベロッパディレクトリ管理 - Qiita

Share on

END
END
@aiandrox

 
目次