Open1

command line developer toolsがないと言われて

haru256haru256

経緯

pyenv install ~とすると以下の文句がでた

❯ pyenv install 3.10.5
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.5.tar.xz...
-> https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tar.xz
Installing Python-3.10.5...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 10.16 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/8_/j02htvj14tl2yyj87fwy99tm0000gn/T/python-build.20220729015405.3759
Results logged to /var/folders/8_/j02htvj14tl2yyj87fwy99tm0000gn/T/python-build.20220729015405.3759.log

Last 10 log lines:
creating Modules/Setup.local
creating Makefile


If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations


make: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk '' -find make 2> /dev/null' failed with exit code 256: (null) (errno=No such file or directory)
xcode-select: Failed to locate 'make', requesting installation of command line developer tools.

原因

command line developer toolsは実は/Applications/Xcode.app/Contents/Developer/ではなく、/Library/Developer/CommandLineToolsにある。
(今まで大丈夫だったのになんで急にパスが変わったのかわからん、、、)

解決策

xcode-select -s /Library/Developer/CommandLineToolsを実行し、command line developer toolsが入っているディレクトリを指定する。
ただし、/Applications/Xcode.app/Contents/Developer/Library/Developer/CommandLineToolsのどちらに本来command line developer toolsがあるべきかは謎なので、一時的な対処法かもしれない。