Skip to content

Building requires Xcode Command Line Tools to be selected #2287

@hisaac

Description

@hisaac

Ever since updating to macOS Sonoma, I've been unable to build Ruby using ruby-build as normal. After much troubleshooting, I determined that I needed to explicitly select the Xcode Command Line Tools as the active developer directory prior to running the command, it doesn't seem to work if a copy of Xcode is selected.

(I also have to explicitly point to the homebrew-installed version of openssl, but I believe this is likely a separate issue.)

Here are some various permutations I've tested with the same or similar results:

  • macOS: versions 14.0 and 14.1
  • Xcode.app: versions 14.3.1, 15.0, and 15.0.1
  • ruby-build: versions 20230919, 20231012, 20231014, 20231025 (every version since macOS Sonoma's release on September 26)

Steps to reproduce the behavior

  1. Select a version of Xcode as the active developer directory using xcode-select
    sudo xcode-select -s /Applications/Xcode-15.0.1.app/Contents/Developer/
  2. Attempt to install Ruby as normal
    RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" ruby-build 3.2.2 ~/local/ruby-3.2.2
  3. Note the build failed (see logs below for more details)
  4. Now select the Xcode Command Line Tools as the active developer directory
    sudo xcode-select -s /Library/Developer/CommandLineTools
  5. Attempt to install Ruby once again using the same command as in step #​2.
  6. Note the build succeeds (see logs below for more details)

Expected vs. actual behavior

  • Expected: I am able to successfully install Ruby on my computer running macOS Sonoma, regardless of if Xcode or the Xcode Command Line Tools are selected as the active developer directory.
  • Actual: I am unable to successfully install Ruby on my computer running macOS Sonoma if a copy of Xcode.app is selected as the active developer directory. I must explicitly select the Xcode Command Line Tools as the active developer directory in order to successfully install Ruby.

Logs

I got an error when I tried to include the verbose logs pasted here into this Issue, so I'll attach them here as txt files instead:

Failing Build

These are the logs from a failing build, after selecting /Applications/Xcode-15.0.1.app/Contents/Developer/ as the active developer directory:

❯ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" ruby-build 3.2.2 ~/local/ruby-3.2.2
To follow progress, use 'tail -f /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027132223.49795.log' or pass --verbose
Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew

BUILD FAILED (macOS 14.1 using ruby-build 20231025)

Inspect or clean up the working tree at /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027132223.49795.6lJmlP
Results logged to /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027132223.49795.log

Last 10 log lines:
In file included from ./fiddle.h:46:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
#if FFI_GO_CLOSURES
    ^
ld: warning: ignoring duplicate libraries: '-lruby.3.2'
installing default fiddle libraries
1 warning generated.
linking shared-object fiddle.bundle
ld: warning: ignoring duplicate libraries: '-lffi', '-lruby.3.2'
make: *** [build-ext] Error 2

Successful Build

These are the logs from a successful build, after selecting /Library/Developer/CommandLineTools as the active developer directory:

❯ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" ruby-build 3.2.2 ~/local/ruby-3.2.2
To follow progress, use 'tail -f /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027131830.14178.log' or pass --verbose
Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
Installed ruby-3.2.2 to /Users/ihalvorson/local/ruby-3.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions