title: Pyenv, Python installation failure: OpenSSL development header is not installed
body: <p>I've been unable to use Pyenv to install Python on macOS (10.13.6) and have exhausted advice about common build problems. </p>
  
  <p>pyenv-doctor reports: <strong>OpenSSL development header is not installed.</strong> Reinstallation of OpenSSL, as suggested in various related GitHub issues has not worked, not have various flag settings, eg (in various combinations):</p>
  
  <pre><code>export CFLAGS="-I$(brew --prefix openssl)/include"
  export CPPFLAGS="-I$(brew --prefix openssl)/include"
  export LDFLAGS="-L$(brew --prefix openssl)/lib"
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig/"
  export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
  </code></pre>
  
  <p>(Tried these in command line put as well.)</p>
  
  <p>(Tried both OpenSSL 1.02p and 1.1, via Homebrew)</p>
  
  <p>Tried</p>
  
  <pre><code>brew install readline xz
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.6.6
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$ CFLAGS="-I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 3.6.6
  </code></pre>
  
  <p>and</p>
  
  <pre><code>xcode-select --install
  (or via downloadable command line tools installer for reinstallation)
  </code></pre>
  
  <p>No luck.</p>
  
  <pre><code>brew link --force openssl
  </code></pre>
  
  <p>is disallowed (error message says to use flags).</p>
  
  <p>Also tried:</p>
  
  <pre><code>$(brew --prefix)/opt/openssl/bin/openssl
  </code></pre>
  
  <p>and tried the OpenSSL/macOS advice here:</p>
  
  <pre><code>https://solitum.net/openssl-os-x-el-capitan-and-brew/
  </code></pre>
  
  <p>$PATH shows:</p>
  
  <pre><code>/usr/local/opt/openssl/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/.nvm/versions/node/v8.11.3/bin:/Users/tomclaburn/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/mongodb/bin:/usr/local/opt/openssl/bin/openssl:/usr/local/mongodb/bin:/usr/local/mongodb/bin
  </code></pre>
  
  <p>and .bash_profile contains:</p>
  
  <pre><code>if [ -d "${PYENV_ROOT}" ]; then
     export PATH="${PYENV_ROOT}/bin:${PATH}"
     eval "$(pyenv init -)"
     #eval "$(pyenv virtualenv-init -)"
  fi
  </code></pre>
  
  <p>I suspect there's a missing/incorrect path or link but I've been unable to determine what it might be. Any advice would be welcome.</p>
  
  <p>Pyenv error output:
  BUILD FAILED (OS X 10.13.6 using python-build 20180424)</p>
  
  <p>...</p>
  
  <p>Last 10 log lines:</p>
  
  <pre><code>checking size of long... 0
  checking size of long long... 0
  checking size of void *... 0
  checking size of short... 0
  checking size of float... 0
  checking size of double... 0
  checking size of fpos_t... 0
  checking size of size_t... configure: error: in `/var/folders/jb/h01vxbqs6z93h_238q61d48h0000gn/T/python-build.20180819081705.3009/Python-3.6.6':
  configure: error: cannot compute sizeof (size_t)
  </code></pre>
  
  <p>pyenv-doctor error output:</p>
  
  <pre><code>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... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether clang accepts -g... yes
  checking for clang option to accept ISO C89... none needed
  checking for rl_gnu_readline_p in -lreadline... yes
  checking for readline/readline.h... no
  checking for SSL_library_init in -lssl... yes
  checking how to run the C preprocessor... clang -E
  checking for grep that handles long lines and -e... /usr/bin/grep
  checking for egrep... /usr/bin/grep -E
  checking for ANSI C header files... no
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... no
  checking for string.h... no
  checking for memory.h... no
  checking for strings.h... no
  checking for inttypes.h... no
  checking for stdint.h... no
  checking for unistd.h... yes
  checking openssl/ssl.h usability... no
  checking openssl/ssl.h presence... no
  checking for openssl/ssl.h... no
  configure: error: OpenSSL development header is not installed.
  </code></pre>