我最近使用以下命令在我的mac上安装了Ruby:
brew install rbenv ruby-build
然后我被指示输入此命令将rbenv添加到bash,以便每次终端打开时加载:
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
现在,每当我打开终端时,我都会收到此错误:
Last login: Sun Sep 6 17:30:09 on ttys000
-bash: /Users/pw/.bash_profile: line 1: syntax error near unexpected token `source'
-bash: /Users/pw/.bash_profile: line 1: `if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi source /Users/pw/.bash_profile'
有关如何阻止此错误显示的任何想法?
由于
答案 0 :(得分:2)
~/.bash_profile
底部应该有一行说明:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
这就是全部。没有提到source anything
。