0

Short explanation.

After I've created .bash_profile file and added the line export PATH=/PATH/TO/YOUR/sbt/bin:$PATH into it, my terminal stopped working properly. Could you please help me to fix the problem? enter image description here

Long explanation. All I wanted and still want is to install Scala. I followed this instruction:

Mac OS X If you use the homebrew package manager, simply type brew update and then brew install sbt in a Terminal prompt.

Otherwise, install sbt by following these steps:

Verify that sbt is installed correctly: Open a new terminal (to apply the changed .bash_profile) using the Terminal application in /Applications/Utilities/ and type sbt -h, you should see a help message from sbt.

First, I tried it with Homebrew and followed this instructions. It didn't work well, so I decided to go through the steps above. After I created the .bash_profile file and added the line export PATH=/PATH/TO/YOUR/sbt/bin:$PATH (with the valid path, of course), terminal went crazy. Your help is more than welcome!

EDIT:

Ina:sbt ps1$ echo $PATH

//Users/ps1/Documents/PS

5
  • Are you sure you don't have a typo somewhere? Can you run echo $PATH and paste the output of that.
    – Bowen
    Oct 23, 2014 at 21:29
  • I get //Users/ps1/Documents/PS
    – Ina
    Oct 23, 2014 at 21:32
  • I don't have PS in Documents, only PS 1.
    – Ina
    Oct 23, 2014 at 21:33
  • Have you looked at: apple.stackexchange.com/questions/66931/terminal-path-error
    – Bowen
    Oct 23, 2014 at 21:39
  • echo $PATH prints now /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin
    – Ina
    Oct 23, 2014 at 22:34

1 Answer 1

1

If the path includes spaces, you're going to need to quote it.

Your line export PATH=/Users/ps1/Documents/PS 1/whatever-else/:$PATH causes Bash to interpret the PATH=/Users/ps1/Documents/PS part as the full first argument to your PATH—telling export to set the PATH to only the section before the space. If you use export "PATH=/Users/ps1/Documents/PS 1/whatever-else/:$PATH", it will interpret the entire PATH=/Users/ps1/Documents/PS 1/whatever-else/:$PATH as part of the first argument. By convention, most people only quote the right side of the equals sign, because it looks nicer, it's the only thing that needs quoted, and bash automatically concatenates strings with no spaces between them.

4
  • I see.. I managed to open the .bash_profile file and added the quotation marks. Unfortunately, I still see the following message when I open the terminal: Last login: Fri Oct 24 00:15:50 on ttys000 -bash: export: “PATH=//Users/ps1/Documents/PS': not a valid identifier -bash: export: 1/sbt/bin:??': not a valid identifier
    – Ina
    Oct 23, 2014 at 22:32
  • 1
    @Ina You have smart quotes. That does not work. You can just copy and paste from my post or use another editor like nano or emacs.
    – 0942v8653
    Oct 23, 2014 at 22:34
  • You are right. The problem is solved. THANK YOU! Now I just have to figure out why the command sbt -h prints a wrong message out.
    – Ina
    Oct 23, 2014 at 22:41
  • This might be helpful for those who encounter the same problem: stackoverflow.com/questions/18819124/…
    – Ina
    Oct 23, 2014 at 22:42

You must log in to answer this question.

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