0

I've been getting this error for the past couple of months and I wonder if it's a major issue, and how do I fix it?

When I open terminal on my Mac I get this bash error:

~bash: /Users/admin/.bash_profile: line 1: syntax error near unexpected token 'fi'
~bash: /Users/admin/.bash_profile:line 1: 'if which rbenv > /dev/null; than eval "$(rbenv init -)"; fi'

Anybody know what's going on?

  • Well, that "than" should probably be "then" but I'm not really a scripting expert. (Are you logging in to the "admin" account or is something else referencing the admin profile?) – Phillip Mills Aug 2 '15 at 12:54
  • Login as admin and start TextEdit. Open .bash_profile and correct the typo. – Mark Setchell Aug 2 '15 at 14:17
  • There isn't a .bash_profile file in admin? – dmsquare Aug 2 '15 at 14:39
1

Open the Terminal.app and type the following line at your prompt

sed -i '' 's/than/then/' .bash_profile

You do have a .bash_profile in your home directory.

  • 1
    @dmsquare please mark this as the accepted answer if you are satisfied with it. – Chris Page Aug 6 '15 at 5:20
1

To add a little information to fd0's terse answer.

First, you do indeed have a file .bash_profile in admin's home folder - you just can't see it as all files with a name that starts . are invisible. In the Terminal type ls -A and you will see them all.

Second, your problem is that something or someone has added a line to the file containing a syntax error. The than should be then as it is part of an if-then statement. Open the file in your favourite text editor (if you don't have one then newcomers seem to find nano usable so nano .bash_profile in Terminal should do it) and change the line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .