pyenvでpythonをインストールしようとすると以下のようなエラーが発生しました。 (原因かはわかりませんが、macOSのバージョンを10.13に上げてから発生しました。)
$ pyenv install 3.6.4 python-build: use openssl from homebrew python-build: use readline from homebrew Installing Python-3.6.4... python-build: use readline from homebrew BUILD FAILED (OS X 10.13.2 using python-build 1.2.1-1-g6f27c91) Inspect or clean up the working tree at /var/folders/b8/hc18sg7s6j9dk1d9sn2q__6w0000gn/T/python-build.20180119133025.71269 Results logged to /var/folders/b8/hc18sg7s6j9dk1d9sn2q__6w0000gn/T/python-build.20180119133025.71269.log Last 10 log lines: checking for --with-icc... no checking for gcc... clang checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/var/folders/b8/hc18sg7s6j9dk1d9sn2q__6w0000gn/T/python-build.20180119133025.71269/Python-3.6.4': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details make: *** No targets specified and no makefile found. Stop.
Xcodeが入っていなかった?みたいで以下のコマンド実行後に、再度インストールを実行するとできました。
$ xcode-select --install