10

I am a beginner trying to setup a developer environment on my new Mac following the steps from this link: http://vanderveer.be/setting-up-my-perfect-developer-environment-on-osx-10-8-mountain-lion-10-8-2-final-edition/.

After executing the files from git, my terminal window now shows:

rbenv: version `1.9.3-p194' not installed
-bash: __git_ps1: command not found

The first line only shows when I open a new terminal window, while the second shows everytime I press return no matter what I type into the terminal.

I have read through many questions on stackoverflow and tried to mimic their solutions to no avail. I think I've made a mistake in installing the package from git as I am not so experienced and I think now I may have messed up the configurations, and was also wondering if there is any way to go back to default settings for bash?

Many thanks! Allen

alchuang
  • 3,487
  • 3
  • 34
  • 48
  • If you look at the comments of that link you pointed us to, you'll see [this illuminating comment:](http://vanderveer.be/setting-up-my-perfect-developer-environment-on-osx-10-8-mountain-lion-10-8-2-final-edition/#comment-904588335) "the __git_ps1 is when the git bash completion scripts are not available. Make sure you installed bash_completion and git". There's additional useful comments on that page as well. – Michael Dautermann Oct 06 '13 at 07:04
  • I did read those comments and tried their solutions to no avail, which is why I came to stackoverflow for help. Thanks! – alchuang Oct 06 '13 at 07:12
  • What git version do you have? Do you have bash_completion installed (as in http://superuser.com/a/288491/141)? – VonC Oct 06 '13 at 07:42

1 Answers1

18

If you've not installed a newer version of Git on your Mac, start by doing that. You can grab the download from here: http://git-scm.com/download

Once it's installed, you should source git-completion.sh and git-prompt.sh from your ~/.profile (or ~/.bashrc, if you have it):

source /usr/local/git/contrib/completion/git-completion.bash
source /usr/local/git/contrib/completion/git-prompt.sh

That should fix the __git_ps1 error.

I'm not a Rubyist, but the rbenv error is coming from the fact that the setup in the dotfiles you are following is trying to set the default Ruby version to "1.9.3-p194". The rbenv tool is there to make a number of different Ruby versions available, but you have to install them first. In your case, I think you need to run this:

rbenv install 1.9.3-p194

After that, the version will be available, and you shouldn't see the warning anymore.

John Szakmeister
  • 44,691
  • 9
  • 89
  • 79
  • `/usr/share/git/completion/` in my case (Arch) – Mr_and_Mrs_D Mar 10 '14 at 14:00
  • `source /usr/lib/git-core/git-sh-prompt` to fix the `__git_ps1` incident in my case (git 2.7.4 on Ubuntu 16.04). The in-line comments in that file do suggest to copy it to a local directory and rename it `git-prompt.sh` – XavierStuvw Apr 01 '20 at 08:47