Wraps variables inside `when` for macosx. Refs #461.
Merge pull request #475 from gradha/pr_macosx_gnu_readline

Wraps variables inside `when` for macosx. Fixes #461.