Bash error when opening terminal [closed]

三世轮回 提交于 2020-01-11 14:40:52

问题


I recently installed Ruby on my mac using this following command:

brew install rbenv ruby-build

I was then instructed to enter this command to add rbenv to bash so it loads every time the terminal is open:

# 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

Now, everytime I open the terminal I get this error:

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'

Any ideas to how I can stop this error from showing?

Thanks


回答1:


There should be a single line at the bottom of your ~/.bash_profile that says:

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

That's all. No mention of source anything.



来源:https://stackoverflow.com/questions/32425868/bash-error-when-opening-terminal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!