-
Notifications
You must be signed in to change notification settings - Fork 5
Deploy on macOS
macOS comes with a Bash version with GPLv2 license, it is a version back in 2007:
$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.To use newer version,
-
Install from brew:
$ brew install bash -
Whitelist it:
$ sudo vim /etc/shellsAnd add
/usr/local/bin/bashto/etc/shells. -
Finally set default shell:
$ chsh -s /usr/local/bin/bash $ echo $BASH_VERSION $ sudo chsh -s /usr/local/bin/bash
Do not set $TERM in bashrc! It should be set by terminal emulator. However, to make prompt $PS1 display properly (italics) in tmux, it's best to use tmux-256color as tmux default-terminal, as in tmux.conf. And ncurses in macOS does not provide the right terminfo out-of-box, which creates problem for using Vim in tmux session. To enable tmux-256color terminfo support in macOS, see terminfo.
When installing using brew, use the cask version, because it has python/dyn and python3/dyn enabled. Otherwise you need to compile Vim.
I use a Python 3.8.6 version installed by pyenv. Its dynamic library (called framework in macOS) is linked in vimrc. To build CPython with framework support on macOS:
-
Uninstall
binutilswith brew temporarily. Usually instead of uninstalling we can do$ AR=/usr/bin/ar pyenv install ...but with option in next step this won't work. So we need to uninstall
binutilsand install it back afterwards. -
Run following in Bash:
$ PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.8.6
I tried this with pyenv-virtualenv but no luck.
This command queries system appearance:
$ defaults read -g AppleInterfaceStyleIn my vimrc, function MacBackground() utilises it.
Per this pull of MacVim:
- An event
OSAppearanceChangedis added. This event is emitted when MacVim changes its appearance. - A vim variable
v:os_appearanceis added. This variable reflects the appearance setting.
In my vimrc, function MacGUIBackground() utilises it.