【发布时间】:2015-09-06 16:40:08
【问题描述】:
我最近使用以下命令在我的 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'
关于如何阻止此错误显示的任何想法?
谢谢
【问题讨论】:
-
source ~/.bash_profile行不应出现在您的~/.bash_profile中。使用 TextEdit 打开它并删除该行。 -
如果失败,请点击您的问题下方的
edit并粘贴您的~/.bash_profile的全部内容 -
行
source ~/.bash_profile的部分。您似乎已在.bash_profile文件中将两行方向合并为一行。