I am a new web programmer setting up a Rails environment on my MacBook Air (Mountain Lion). I have just started Hartl's Rails tutorial.
I have installed the latest version of git and I used the following instructions to set up password caching: https://help.github.com/articles/set-up-git. Everything seemed to be working okay. Got my repository up and running and was able to push a branch to github.
But now, whenever I type $ clear
into the command line to clear the screen, bash returns:
usage: git credential-osxkeychain <get|store|erase>
and does not clear the screen. What happened to the $ clear
command??
I have no idea why this is happening, whether it's an isolated problem or if it is indicative of a more widespread error in my setup. Typing $ which clear
shows clear in /usr/local/bin/clear. If anyone knows what is going on, please help!
UPDATE - MORE INFORMATION!!
Actually, @chrisaycock was correct, there is a clear
command in usr/bin. When I execute that command directly (/usr/bin/clear
), it works as expected. However, the clear
command in usr/local/bin is the one that is giving me problems. Also, which clear
only returns usr/local/bin
and ignores the usr/bin
(Is this because the latter is a bash include?) Maybe it's a $PATH problem? I have pasted my .bash_profile and .bashrc files below. However, when I echo $PATH
I get a lot of unexpected paths. I assume it is from the included .rvm stuff from the .bash_profile but I am not sure. If there's someone out there with some insight, I could use some help understanding (1) whether my problem with the clear
command is a $PATH problem, (2) how to fix it, whether it's a $PATH issue or not and (3) why echo $PATH
returns such a long list of paths (suspect the .rvm include, but want to confirm). Thanks, everyone who's commented so far!
echo $PATH
/Users/NAME/.rvm/gems/ruby-2.0.0-p195@rails3tutorial2ndEd/bin:/Users/NAME/.rvm/gems/ruby-2.0.0-p195@global/bin:/Users/NAME/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/NAME/.rvm/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
.bashrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
esource ~/.git-prompt.sh # Load in the git branch prompt script.
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
PS1="\w\$(__git_ps1) $ "
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
.bash_profile
export PATH=/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
source ~/.git-prompt.sh # Load in the git branch prompt script.
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
PS1="\w\$(__git_ps1) $ "
(1) There is the /usr/bin/clear
(which you want) and the /usr/local/bin/clear
(which you don't want). which clear
returns the one which would be executed; which -a clear
returns both. Since the command first found when searching the directories in $PATH is executed, and /usr/local/bin
precedes /usr/bin
here, it's /usr/local/bin/clear
.
(2) You can fix this e. g. by reversing the order of /usr/local/bin
and /usr/bin
in $PATH, or by deleting or renaming /usr/local/bin/clear
.
(3) The front part of $PATH (/Users/NAME/.rvm/gems/ruby-2.0.0-p195@rails3tutorial2ndEd/bin:/Users/NAME/.rvm/gems/ruby-2.0.0-p195@global/bin:/Users/NAME/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/NAME/.rvm/bin:
) seems to come from the .rvm script; the rear part of $PATH (/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
) comes from the first line of .bash_profile
(here you could change the order of /usr/local/bin
and /usr/bin
).