无法让Homebrew和git以我想要的方式工作

时间:2013-07-15 10:55:44

标签: ruby-on-rails git osx-mountain-lion homebrew

首先,我很抱歉我犯了任何愚蠢的错误。我刚刚开始使用OneMonthRails,这对我来说都很新鲜。我的问题是Homebrew和git。我被告知我的问题与环境变量有关,而且我做了足够的研究以确信这是正确的。好的,这是详细信息:

我试图安装Homebrew,但遇到Xcode缺席的障碍。运行OSX 10.6.8,并且必须升级到至少10.7.x才能安装最新的Xcode。我升级到OSX 10.8.4并安装了Xcode并重新启动了以下行

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

我得到以下脚本:

==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help

我正在安装Homebrew,以便我可以安装ImageMagick以运行Paperclip gem,所以我接受终端关于运行$ brew医生的建议。

$ brew doctor

生成行

Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: Broken symlinks were found. Remove them with `brew prune`:

///完整的符号链接列表///

Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git

我想知道我的git版本是什么,所以我运行以下脚本:

$ git --version

并生成以下行:

git version 1.7.9.6

我确定了我的git所在的位置:

$ which git

然后带来:

/opt/sm/pkg/active/bin/git

经过一些研究后,我发现我可以使用以下脚本升级我的git:

$ brew install git

生成的脚本的最后一行是警告:

Warning: This keg was marked linked already, continuing anyway
==> Summary
  /usr/local/Cellar/git/1.8.3.2: 1325 files, 28M, built in 45 seconds

我验证了我的git升级

$ git --version

git version 1.7.9.6

sudo认为......也许我需要运行升级而不是安装。

///重启电脑///

$ brew upgrade git
Error: git-1.8.3.2 already installed
嗯...再试一次医生

$ brew doctor

Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

$ git --version
git version 1.8.3.2

YAY!我有点对了!现在用Homebrew完成,这样我就可以继续安装ImageMagick了:

$ brew doctor

Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Arrg ......我刚刚安装了Xcode。如何安装命令行工具?什么是这个配置警告?我在StackOverflow上检查它,它引导我到这里: (... /问题/ 15225312 / BREW的医生给出出的警告)

我不知道自己在做什么,所以以下是有点愚蠢的

$ $PATH

没了

$ echo $PATH

...无

$ export PATH=/sm/pkg/active/bin/

没有

$ export PATH= /sm/pkg/active/bin/
-bash: export: `/sm/pkg/active/bin/': not a valid identifier

注意= 之后的空格)

我意识到我有多少不知道自己在做什么,所以我请求帮助

$ brew help
-bash: brew: No such file or directory
噢,哦......

$ brew doctor
-bash: brew: No such file or directory
我认为我打破了我的电脑。我该怎么办???我需要让Homebrew运行,以便我可以安装ImageMagick图像处理器并在Rails中使用Paperclip gem。

:((

2 个答案:

答案 0 :(得分:3)

我知道这非常令人沮丧,有些令人困惑的是让这一切都奏效。去过那里,做到了。

这里有几件事情在玩,所以一次拿一个(事实上。我只是猜测一些东西,所以我很乐意在你告诉我更多时更新这个答案)

让我们从:

开始

Warning: Experimental support for using Xcode without the "Command Line Tools". You have only installed Xcode. If stuff is not building, try installing the "Command Line Tools" package provided by Apple.

强烈建议您安装命令行工具。它将安装gcc和其他工具,帮助编译自制程序下载的代码。

  1. 打开Xcode。
  2. 打开首选项。
  3. 在顶部栏上,选择“下载”
  4. 安装“命令行工具”
  5. 其次,我不确定你是如何彻底吹走你的道路的。我首先看看你是否搞砸了这个终端,如果你关闭它并开始一个新的终端窗口,如果你的PATH没问题。

    然而,如果失败了,这里有一条路径,它有一些基本的搜索路径可以帮助你上路:

    export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/sbin

    您应该检查.zshrc / .zsh_profile或.bashrc / .bash_profile,看看您将PATH设置为。

    当您输入该命令时,您不希望=两侧的空格。

答案 1 :(得分:0)

我最近尝试从10.6升级到10.8(安装rails,bundler,RVM)并且遇到了很多与brew和RVM冲突相同的问题并且有各自独立的问题(PATH,权限/不可写文件夹,旧版本XCode等)。在我将所有东西(TMachine,git和手动复制选定的目录树)三倍备份后,它没有问题,并且干净的Mountain Lion安装了USB驱动器。

如果您只有PATH问题,可以手动/临时编辑(直到下次运行.bashrc,根据答案评论:Brew doctor gives out warnings