Battling with macOS

The past few days were overshadowed by headaches with macOS. First, fman's command for installing plugins started giving a very ugly error:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(
host='api.github.com', port=443): Max retries exceeded with url: /
(Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION]
tlsv1 alert protocol version (_ssl.c:720)'),))

This was caused by macOS using an outdated OpenSSL version. To fix this, fman's Python version was updated to 3.6. Unfortunately, this in turn lead to fman crashing on some Mac users' systems.

The crashes were likely caused by an incompatibility between Python 3.6 and PyInstaller, the framework which is used to turn fman's source code into a standalone application. PyInstaller added support for Python 3.6 only recently, and it appears there are still a few kinks.

So, the solution was to downgrade to Python 3.5 again. To still fix the original SSLError, fman's copy of Python had to be recompiled with the latest OpenSSL version. The result was release 0.9.2.

Except it didn't end there. Some users reported the crash on startup fixed, but others were still seeing it. Further investigations showed that it was because fman's copy of Python had now been compiled on macOS 10.13, which made it backwards-incompatible with (eg.) macOS 10.11.

So, finally, the solution was to compile fman's Python version on an older version of macOS. This is release 0.9.4, which just came out. All users who previously reported having trouble starting fman now say that it works. If you still encounter issues, please get in touch.

Appendix: Compiling Python with OpenSSL on macOS

If you found this page on Google, you may be interested in how to (re-)compile Python 3(.5) on macOS with the latest version of OpenSSL. The easiest way I found is via Homebrew and pyenv:

brew update
brew install openssl
brew install pyenv

Then, add the following lines to ~/.bashrc:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Ensure the changes take immediate by executing source ~/.bashrc. Then compile Python with the new OpenSSL version:

PYTHON_CONFIGURE_OPTS="--enable-shared" CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 3.5.4

To use pyenv with a virtual environment, you can then optionally also perform the following steps:

git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv

Then, add the following to .bashrc and source ~/.bashrc again:

eval "$(pyenv virtualenv-init -)"

This lets you finally create and activate a new virtual environment using our new Python with updated OpenSSL:

pyenv virtualenv 3.5.4 venv
pyenv activate venv

Michael started fman in 2016, convinced that we deserve a better file manager. fman's launch in 2017 was a huge success. But despite full-time work, it only makes $500 per month. The goal is to fix this.