Automatically restore virtualenv in Terminal.app on macOS (zsh, bash)

Ilya Kulakov kulakov.ilya at gmail.com
Thu Jan 12 20:20:49 EST 2017


Today I discovered that one can customize session restoration in Terminal.app
by defining the shell_session_save_user_state function.

Here is a script that restores active virtualenv, e.g. after you reboot your machine:

    https://gist.github.com/Kentzo/185e4eab382bbcf1f0a9738a28128dce

It's written for ZSH, but it's fairly simple to port it to bash: you don't even need plugin,
since session management is supported out of the box.

Here is a plugin for oh-my-zsh:

    https://github.com/Kentzo/oh-my-zsh/tree/master/plugins/session


More information about the Python-list mailing list