Zsh
RVM 需要
- 可能為空 (無相符項目) 的 glob 用法。如果您遇到 glob 問題,請嘗試在您的 zsh 設定檔中設定 'setopt nullglob'。
- 透過運算子 =~ 提供 shell 正規表示式支援。 =~ 最早出現在 4.3.5 中,(它已新增至 zsh-workers-23375。 )
我如何得知我的 zsh 版本是否支援 =~?
$ foo=baaaar; [[ $foo =~ ba*r ]] && echo "Your shell supports the =~ regex operator." || echo "Your shell does not support the =~ regex operator." Your shell supports the =~ regex operator. $ zsh --version zsh 4.3.5
$ foo=baaaar; [[ $foo =~ ba*r ]] && echo "Your shell supports the =~ regex operator." || echo "I like sheep, they are soft and fluffy..." zsh: condition expected: =~ $ zsh --version zsh 4.3.4
我如何升級我的 zsh 版本?
version="4.3.10" ; mkdir -p ~/.src && cd ~/.src && \curl -O -L --create-dirs -C - http://downloads.sourceforge.net/project/zsh/zsh-dev/$version/zsh-$version.tar.bz2?use_mirror=voxel && tar jxf zsh-$version.tar.bz2* && cd zsh-$version && ./configure --prefix=/ && make && sudo make install
如果您正在使用 zsh(可能搭配 oh-my-zsh),而您的提示字元將目前目錄顯示為 "~rvm_rvmrc_cwd",修正方式是在取得 rvm 來源之前將以下內容新增至您的 shell 檔案
unsetopt auto_name_dirs
如果您正在使用 oh-my-zsh,並且看到類似這樣的錯誤
pwd:4: too many arguments
這是由別名造成的,而且是因為使用 '.' 運算子而非 'source' 來取得指令碼來源的 sh 風格。別名看起來像這樣
# .oh-my-zsh/lib/aliases.zsh alias .='pwd'
若要避免此問題,請移除/註解別名和/或跳脫 '.' 以略過別名,如下所示
\. /file/being/sourced
最新的 RVM HEAD 正確跳脫取得來源的 '.',因此這不再會是問題。如果您看到與 RVM 指令碼相關的此問題,請更新 (rvm get head)。
zsh + iTerm
開啟 iTerm 設定偏好設定 ⌘,
導覽至偏好設定
如果沒有 ZSH 設定檔,請建立一個。
設定命令:為 登入 shell
重新載入 iTerm
如果您在 iTerm 上仍然收到 rvm 不是函式 錯誤,請嘗試
rvm get stable --auto-dotfiles
zsh + oh my zsh
如果您想要使用 oh my zsh,請務必不要使用 bundler 套件。如果 rvm 應該處理所有事情,它會為您執行此動作。