头部使用未知选项-1 / -n错误。 可能与ruby有关

在OSX 10.9.1中启动终端时,我遇到了一个反复出现的问题。

每次我启动终端时,我都会重复以下至少30次

Unknown option: 1 Usage: head [-options] ... -m  use method for the request (default is 'HEAD') -f make request even if head believes method is illegal -b  Use the specified URL as base -t  Set timeout value -i  Set the If-Modified-Since header on the request -c  use this content-type for POST, PUT, CHECKIN -a Use text mode for content I/O -p  use this as a proxy -P don't load proxy settings from environment -H 
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 Process HTML content in various ways -v Show program version -h Print this message -x Extra debugging output

最后是

 /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 

这重复了50次

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

弄清楚与Ruby有关,我试过了

 rvm get stable 

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

但后来得到错误:

SSL证书问题:证书链中的自签名证书

我也尝试修复权限(像往常一样)没有解决方案(像往常一样)

这不是我熟悉的领域,所以我不确定现在哪棵树吠了。 有人可以帮忙吗?

以下是请求的.bashrc和.bash_profile内容

.bashrc内容:

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

.bash_profile内容:

 # 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' 

谢谢,史蒂夫

我有完全相同的问题。 它源于rbenv尝试在其中一个脚本中使用head -1 ,但是失败了。

问题是你(和我的那个) .bash_profile包含:

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

/Applications/XAMPP/xamppfiles/bin文件夹包含一个名为HEAD的脚本(以HTTP方法命名)和一个不区分大小写的文件系统以及bash(因为ZSH没有这个问题)得到headHEAD混合并且以$PATH b中的第一个为准。

作为解决方案:

  • $PATH移除/Applications/XAMPP/xamppfiles/bin (或最后移动它)
  • 或者,正如我所做的那样, mv HEAD HTTP_HEAD在该文件夹中。

PS。 后一个选项可能会破坏一些XAMPP脚本,但我仍然需要在我的路径中使用正确的XAMPP php版本。

通过使用解决

 rvm implode 

删除ruby版本管理器

然后按照卸载程序结束时的说明删除我的用户名文件夹中.bashrc,.bash_profile和.zshrc中对rvm的引用。