drnmslpz42661 2014-07-11 21:39
浏览 49
已采纳

Ruby命令与$ gopath中的程序冲突

I had rbenv installed (with homebrew) and working on my mac with several versions of ruby in the past. For a period of time I didn't use Ruby very much and have installed other things (including OSX 10.9.3 and Go) on my computer. I ran rbenv today and it repeated this message over and over

tory
/usr/local/bin/rbenv: line 14: cd: Usage:  Head host:port: No such file or directory
/usr/local/bin/rbenv: line 14: cd: Usage:  Head host:port: No such file or directory
/usr/local/bin/rbenv: line 14: cd: Usage:  Head host:port: No such file or directory
/usr/local/bin/rbenv: line 14: cd: Usage:  Head host:port: No such file or directory
^C

When I run ruby -v it repeats this message over and over

/usr/local/Cellar/rbenv/0.4.0/libexec/rbenv: line 14: cd: Usage:  Head host:port: No such file or directory
/usr/local/Cellar/rbenv/0.4.0

I uninstalled rbenv with homebrew and reinstalled it but have the same problem.

When I run jekyll serve -w (to run a jekyll blog locally), I also get the error

/usr/local/Cellar/rbenv/0.4.0/libexec/rbenv: line 14: cd: Usage:  Head host:port: No such file or directory

Update I have recently installed Go on my computer and ran a few Go programs today, one of which is called Head. It appears the error message that I'm getting when trying to run rbenv or jekyll is from one of the Go scripts in my $GOPATH. This is the HEAD script, which is printing the error message

"Usage: ", os.Args[0], "host:port"

This program is located in the $GOPATH

/Users/randomname/go/src/github.com/myname/head

I don't see why that would conflict with Ruby commands

/* Head
 */

package main

import (
    "fmt"
    "net/http"
    "os"
)

func main() {
    if len(os.Args) != 2 {
        fmt.Println("Usage: ", os.Args[0], "host:port")
        os.Exit(1)
    }
    url := os.Args[1]

    response, err := http.Head(url)
    if err != nil {
        fmt.Println(err.Error())
        os.Exit(2)
    }

    fmt.Println(response.Status)
    for k, v := range response.Header {
        fmt.Println(k+":", v)
    }

    os.Exit(0)
}

this is my bash_profile. Question: Is there something in this file that's causing the conflict?

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

export PGHOST=localhost


export LASTFM_API='76479e879457be34dd1180f78e731fc0'

export PATH=${PATH}:/usr/local/mysql/bin
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"

export GOPATH=/Users/randomname/go/
export PATH=$GOPATH/bin:$PATH

# The next line updates PATH for the Google Cloud SDK.
source '/Users/my_name/google-cloud-sdk/path.bash.inc'

# The next line enables bash completion for gcloud.
source '/Users/randomname/google-cloud-sdk/completion.bash.inc'

alias goapp=~/google-cloud-sdk/platform/google_appengine/goapp

export PATH=/path/to/go_appengine:$PATH
  • 写回答

2条回答 默认 最新

  • douyong2531 2014-07-12 08:02
    关注

    It's trying to use GNU head and it's catching your version, which is a completely different program, you will have to change the name to something else and delete $GOPATH/bin/head.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)