10

I have a recurring problem when starting the terminal in OSX 10.9.1.

Every time I start the terminal I get the following repeated at least 30 times

Unknown option: 1
Usage: head [-options] <url>...
-m <method>   use method for the request (default is 'HEAD')
-f            make request even if head believes method is illegal
-b <base>     Use the specified URL as base
-t <timeout>  Set timeout value
-i <time>     Set the If-Modified-Since header on the request
-c <conttype> use this content-type for POST, PUT, CHECKIN
-a            Use text mode for content I/O
-p <proxyurl> use this as a proxy
-P            don't load proxy settings from environment
-H <header>   send this HTTP header (you can specify several)

-u            Display method and URL before any response
-U            Display request headers (implies -u)
-s            Display response status code
-S            Display response status chain
-e            Display response headers
-d            Do not display content
-o <format>   Process HTML content in various ways

-v            Show program version
-h            Print this message

-x            Extra debugging output

followed finally by

/usr/local/bin/rbenv: fork: Resource temporarily unavailable
/usr/local/bin/rbenv: line 63: rbenv---version: command not found
/usr/local/bin/rbenv: line 63: rbenv-help: command not found

and this repeated 50ish times

/usr/local/bin/rbenv: line 63: rbenv---version: command not found
/usr/local/bin/rbenv: line 63: rbenv-help: command not found

Figuring it's Ruby related, I tried

rvm get stable

and

curl -sSL https://get.rvm.io | bash -s stable

but then get the error:

SSL certificate problem: self signed certificate in certificate chain

I've also tried repairing permissions (as usual) with no solution (as usual)

This isn't an area I'm familiar with so I not sure which tree to bark up now. Can anyone help?

Here are the .bashrc and .bash_profile contents as requested

.bashrc contents:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

.bash_profile contents:

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
export PATH=$PATH:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/stevekirkby/.rvm/bin
export PATH=$PATH:/usr/local/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/stevekirkby/.rvm/bin
export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin
export PATH=$PATH:$HOME/.rvm/bin
export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
eval "$(rbenv init -)"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

alias htdocs='cd /Applications/XAMPP/xamppfiles/htdocs'
alias home='cd /Users/stevekirkby'

Thanks, Steve

Zword
  • 6,605
  • 3
  • 27
  • 52
Steve
  • 988
  • 1
  • 12
  • 25
  • You've installed something that wanted to be called `/usr/bin/HEAD` on the OS X case-insensitive filesystem. I know there's an awful Perl HTTP package that does this, but you could have installed something else that does it too. – Wooble Feb 01 '14 at 14:07
  • I hope everyone who reads this question takes this as a strong argument in favor of *not* printing a usage statement in response to an invocation error. "Unknown option: 1" is all that is needed; the rest is noise. – William Pursell Feb 01 '14 at 14:14
  • @WilliamPursell: to be fair, that usage statement made it much easier to tell that an HTTP HEAD tool was running instead of the normal head(1) program... – Wooble Feb 01 '14 at 14:55
  • Thanks wooble. Any ideas how I can fix this? – Steve Feb 01 '14 at 14:58
  • Could you show your .bashrc and .bash_profile files? – Ismael Abreu Feb 01 '14 at 17:11
  • Hi Ismael, added to the original post. Thanks – Steve Feb 05 '14 at 16:26
  • Have you tried reinstalling the os x file `/usr/bin/head`? As I understand @Wobble's point, you probably installed an app that replaced your file `head` with a file named `HEAD`. The developer presumably assumed `head` and `HEAD` would be distinct files, as is the case on non-Mac unix's. I don't know if you can just replace HEAD with os x's head, though that would undoubtedly break the app that's causing the problem. Whoops. Just noticed you solved the problem. Did you ever find out why you had the file `/usr/bin/HEAD`? – Cary Swoveland Feb 06 '14 at 03:50
  • Hi Cary, thanks for the response. The head file was lowercase so I figured that wasn't the problem. Looks like it was rvm-related and most likely, caused by me fouling up the permissions somewhere. Removing rvm as described and reinstalling solved it. – Steve Feb 10 '14 at 13:42

2 Answers2

45

I had exactly the same problem. It stems from rbenv trying to use head -1 in one of it's scripts, but failing.

The problem is that your (and my for that matter) .bash_profile contains:

export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"

And the /Applications/XAMPP/xamppfiles/bin folder contains a script named HEAD (named after the HTTP method) and a case-insensitive file system in conjunction with bash (as ZSH did not have this problem) gets head and HEAD mixed up and serves whichever comes first in $PATHb.

As a solution:

  • either remove /Applications/XAMPP/xamppfiles/bin from your $PATH (or move it last)
  • Or, as I did, mv HEAD HTTP_HEAD in that folder.

PS. the latter option might break some XAMPP scripts but I still need correct XAMPP php version in my path.

Laas
  • 5,978
  • 33
  • 52
2

Solved by using

rvm implode

to remove the ruby version manager

Then followed the instructions at the end of the uninstaller removing references to rvm in the .bashrc, .bash_profile and .zshrc in my username folder.

Steve
  • 988
  • 1
  • 12
  • 25