自制软件安装失败

时间:2015-07-22 22:47:17

标签: macos homebrew

我试图支持那些试图在运行OS X Yosemite版本10.10.4的Macbook Air上安装自制软件的人。不幸的是,我不在机器前面,可能无法立即访问它。我只安装过一次自制软件,但不久之前。我也不是Mac的专家:/

我们使用的命令是从自制主页复制的:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

这是终端输出:

Last login: Wed Jul 22 15:26:05 on ttys000
Imanis-MacBook-Air:~ imanijones$ #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
Imanis-MacBook-Air:~ imanijones$ # This script installs to /usr/local only. To install elsewhere you can just
Imanis-MacBook-Air:~ imanijones$ # untar https://github.com/Homebrew/homebrew/tarball/master anywhere you like or
Imanis-MacBook-Air:~ imanijones$ # change the value of HOMEBREW_PREFIX.
Imanis-MacBook-Air:~ imanijones$ HOMEBREW_PREFIX = '/usr/local'
-bash: HOMEBREW_PREFIX: command not found
Imanis-MacBook-Air:~ imanijones$ HOMEBREW_CACHE = '/Library/Caches/Homebrew'
-bash: HOMEBREW_CACHE: command not found
Imanis-MacBook-Air:~ imanijones$ HOMEBREW_REPO = 'https://github.com/Homebrew/homebrew'
-bash: HOMEBREW_REPO: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ module Tty extend self
-bash: module: command not found
Imanis-MacBook-Air:~ imanijones$   def blue; bold 34; end
-bash: def: command not found
-bash: bold: command not found
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$   def white; bold 39; end
-bash: def: command not found
-bash: bold: command not found
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$   def red; underline 31; end
-bash: def: command not found
-bash: underline: command not found
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$   def reset; escape 0; end
-bash: def: command not found
-bash: escape: command not found
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$   def bold n; escape "1;#{n}" end
-bash: def: command not found
-bash: escape: command not found
Imanis-MacBook-Air:~ imanijones$   def underline n; escape "4;#{n}" end
-bash: def: command not found
-bash: escape: command not found
Imanis-MacBook-Air:~ imanijones$   def escape n; "\033[#{n}m" if STDOUT.tty? end
-bash: def: command not found
-bash: \033[#{n}m: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ class Array
-bash: class: command not found
Imanis-MacBook-Air:~ imanijones$   def shell_s
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$     cp = dup
cp: =: No such file or directory
Imanis-MacBook-Air:~ imanijones$     first = cp.shift
-bash: first: command not found
Imanis-MacBook-Air:~ imanijones$     cp.map{ |arg| arg.gsub " ", "\\ " }.unshift(first) * " "
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$   end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def ohai *args
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   puts "#{Tty.blue}==>#{Tty.white} #{args.shell_s}#{Tty.reset}"
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def warn warning
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   puts "#{Tty.red}Warning#{Tty.reset}: #{warning.chomp}"
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def system *args
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   abort "Failed during: #{args.shell_s}" unless Kernel.system(*args)
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def sudo *args
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   ohai "/usr/bin/sudo", *args
-bash: ohai: command not found
Imanis-MacBook-Air:~ imanijones$   system "/usr/bin/sudo", *args
-bash: system: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def getc  # NOTE only tested on OS X
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   system "/bin/stty raw -echo"
-bash: system: command not found
Imanis-MacBook-Air:~ imanijones$   if STDIN.respond_to?(:getbyte)
-bash: syntax error near unexpected token `:getbyte'
Imanis-MacBook-Air:~ imanijones$     STDIN.getbyte
-bash: STDIN.getbyte: command not found
Imanis-MacBook-Air:~ imanijones$   else
-bash: syntax error near unexpected token `else'
Imanis-MacBook-Air:~ imanijones$     STDIN.getc
-bash: STDIN.getc: command not found
Imanis-MacBook-Air:~ imanijones$   end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ ensure
-bash: ensure: command not found
Imanis-MacBook-Air:~ imanijones$   system "/bin/stty -raw echo"
-bash: system: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def wait_for_user
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   puts
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$   puts "Press RETURN to continue or any other key to abort"
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$   c = getc
-bash: c: command not found
Imanis-MacBook-Air:~ imanijones$   # we test for \r and \n because some stuff does \r instead
Imanis-MacBook-Air:~ imanijones$   abort unless c == 13 or c == 10
-bash: abort: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ class Version
-bash: class: command not found
Imanis-MacBook-Air:~ imanijones$   include Comparable
-bash: include: command not found
Imanis-MacBook-Air:~ imanijones$   attr_reader :parts
-bash: attr_reader: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$   def initialize(str)
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$     @parts = str.split(".").map { |i| i.to_i }
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$   end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$   def <=>(other)
-bash: =/dev/fd/62: No such file or directory
-bash: other: command not found
Imanis-MacBook-Air:~ imanijones$ -bash: other: command not found
    parts <=> self.class.new(other).parts
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$   end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def macos_version
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   @macos_version ||= Version.new(`/usr/bin/sw_vers -productVersion`.chomp[/10\.\d+/])
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def git
-bash: def: command not found
Imanis-MacBook-Air:~ imanijones$   @git ||= if ENV['GIT'] and File.executable? ENV['GIT']
-bash: @git: command not found
-bash: =: command not found
Imanis-MacBook-Air:~ imanijones$     ENV['GIT']
-bash: ENV[GIT]: command not found
Imanis-MacBook-Air:~ imanijones$   elsif Kernel.system '/usr/bin/which -s git'
-bash: elsif: command not found
Imanis-MacBook-Air:~ imanijones$     'git'
usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find by binary search the change that introduced a bug
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty Git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and integrate with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
Imanis-MacBook-Air:~ imanijones$   else
-bash: syntax error near unexpected token `else'
Imanis-MacBook-Air:~ imanijones$     exe = `xcrun -find git 2>/dev/null`.chomp
-bash: exe: command not found
Imanis-MacBook-Air:~ imanijones$     exe if $? && $?.success? && !exe.empty? && File.executable?(exe)
-bash: !exe.empty?: event not found
Imanis-MacBook-Air:~ imanijones$   end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$   return unless @git
-bash: return: unless: numeric argument required
-bash: return: can only `return' from a function or sourced script
Imanis-MacBook-Air:~ imanijones$   # Github only supports HTTPS fetches on 1.7.10 or later:
Imanis-MacBook-Air:~ imanijones$   # https://help.github.com/articles/https-cloning-errors
Imanis-MacBook-Air:~ imanijones$   `#{@git} --version` =~ /git version (\d\.\d+\.\d+)/
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$   return if $1.nil? or Version.new($1) < "1.7.10"
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$   @git
-bash: @git: command not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def chmod?(d)
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$   File.directory?(d) && !(File.readable?(d) && File.writable?(d) && File.executable?(d))
-bash: !: event not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ def chgrp?(d)
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$   !File.grpowned?(d)
-bash: !File.grpowned?: event not found
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ # Invalidate sudo timestamp before exiting
Imanis-MacBook-Air:~ imanijones$ at_exit { Kernel.system "/usr/bin/sudo", "-k" }
-bash: at_exit: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ # The block form of Dir.chdir fails later if Dir.CWD doesn't exist which I
Imanis-MacBook-Air:~ imanijones$ # guess is fair enough. Also sudo prints a warning message for no good reason
Imanis-MacBook-Air:~ imanijones$ Dir.chdir "/usr"
-bash: Dir.chdir: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ ####################################################################### script
Imanis-MacBook-Air:~ imanijones$ abort "See Linuxbrew: http://brew.sh/linuxbrew/" if /linux/i === RUBY_PLATFORM
-bash: abort: command not found
Imanis-MacBook-Air:~ imanijones$ abort "MacOS too old, see: https://github.com/mistydemeo/tigerbrew" if macos_version < "10.6"
-bash: 10.6: No such file or directory
Imanis-MacBook-Air:~ imanijones$ abort "Don't run this as root!" if Process.uid == 0
-bash: !": event not found
Imanis-MacBook-Air:~ imanijones$ abort <<-EOABORT unless `groups`.split.include? "admin"
> This script requires the user #{ENV['USER']} to be an Administrator. If this
> sucks for you then you can install Homebrew in your home directory or however
> you please; please refer to our homepage. If you still want to use this script
> set your user to be an Administrator in System Preferences or `su' to a
> non-root user with Administrator privileges.
> EOABORT
-bash: bad substitution: no closing "`" in `su' to a
non-root user with Administrator privileges.

Imanis-MacBook-Air:~ imanijones$ abort <<-EOABORT unless Dir["#{HOMEBREW_PREFIX}/.git/*"].empty?
> It appears Homebrew is already installed. If your intent is to reinstall you
> should do the following before running this installer again:
>     rm -rf #{HOMEBREW_PREFIX}/Cellar #{HOMEBREW_PREFIX}/.git && brew cleanup
> EOABORT
-bash: abort: command not found
Imanis-MacBook-Air:~ imanijones$ # Tests will fail if the prefix exists, but we don't have execution
Imanis-MacBook-Air:~ imanijones$ # permissions. Abort in this case.
Imanis-MacBook-Air:~ imanijones$ abort <<-EOABORT if File.directory? HOMEBREW_PREFIX and not File.executable? HOMEBREW_PREFIX
> The Homebrew prefix, #{HOMEBREW_PREFIX}, exists but is not searchable. If this is
> not intentional, please restore the default permissions and try running the
> installer again:
>     sudo chmod 775 #{HOMEBREW_PREFIX}
> EOABORT
-bash: abort: command not found
Imanis-MacBook-Air:~ imanijones$ abort <<-EOABORT if `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$?.success?
abort <<-EOABORT if `/usr/bin/xcrun clang 2>&1` =~ /license/ && HOMEBREW_PREFIX?.success?
> You have not agreed to the Xcode license.
> Before running the installer again please agree to the license by opening
> Xcode.app or running:
>     sudo xcodebuild -license
> EOABORT
-bash: abort: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ ohai "This script will install:"
-bash: ohai: command not found
Imanis-MacBook-Air:~ imanijones$ puts "#{HOMEBREW_PREFIX}/bin/brew"
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$ puts "#{HOMEBREW_PREFIX}/Library/..."
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$ puts "#{HOMEBREW_PREFIX}/share/man/man1/brew.1"
-bash: puts: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ chmods = %w( . bin etc include lib lib/pkgconfig Library sbin share var var/log share/locale share/man
-bash: syntax error near unexpected token `('
Imanis-MacBook-Air:~ imanijones$              share/man/man1 share/man/man2 share/man/man3 share/man/man4
-bash: share/man/man1: No such file or directory
Imanis-MacBook-Air:~ imanijones$              share/man/man5 share/man/man6 share/man/man7 share/man/man8
-bash: share/man/man5: No such file or directory
Imanis-MacBook-Air:~ imanijones$              share/info share/doc share/aclocal ).
-bash: syntax error near unexpected token `)'
Imanis-MacBook-Air:~ imanijones$              map { |d| File.join(HOMEBREW_PREFIX, d) }.select { |d| chmod?(d) }
-bash: syntax error near unexpected token `HOMEBREW_PREFIX,'
Imanis-MacBook-Air:~ imanijones$ chgrps = chmods.select { |d| chgrp?(d) }
-bash: syntax error near unexpected token `d'
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ unless chmods.empty?
-bash: unless: command not found
Imanis-MacBook-Air:~ imanijones$   ohai "The following directories will be made group writable:"
-bash: ohai: command not found
Imanis-MacBook-Air:~ imanijones$   puts(*chmods)
-bash: syntax error near unexpected token `*chmods'
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ unless chgrps.empty?
-bash: unless: command not found
Imanis-MacBook-Air:~ imanijones$   ohai "The following directories will have their group set to #{Tty.underline 39}admin#{Tty.reset}:"
-bash: ohai: command not found
Imanis-MacBook-Air:~ imanijones$   puts(*chgrps)
-bash: syntax error near unexpected token `*chgrps'
Imanis-MacBook-Air:~ imanijones$ end
-bash: end: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ wait_for_user if STDIN.tty?
-bash: wait_for_user: command not found
Imanis-MacBook-Air:~ imanijones$ 
Imanis-MacBook-Air:~ imanijones$ if File.directory? HOMEBREW_PREFIX
>   sudo "/bin/chmod", "g+rwx", *chmods unless chmods.empty?
>   sudo "/usr/bin/chgrp", "admin", *chgrps unless chgrps.empty?
> else
-bash: syntax error near unexpected token `else'
Imanis-MacBook-Air:~ imanijones$   sudo "/bin/mkdir", HOMEBREW_PREFIX

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
    getc
  end
end

ohai "Downloading and installing Homebrew..."
Dir.chdir HOMEBREW_PREFIX do
  if git
    # we do it in four steps to avoid merge errors when reinstalling
    system git, "init", "-q"

    # "git remote add" will fail if the remote is defined in the global config
    system git, "config", "remote.origin.url", HOMEBREW_REPO
    system git, "config", "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*"

    args = git, "fetch", "origin", "master:refs/remotes/origin/master", "-n"
    args << "--depth=1" unless ARGV.include?("--full") || !ENV["HOMEBREW_DEVELOPER"].nil?
    system(*args)

    system git, "reset", "--hard", "origin/master"
  else
    # -m to stop tar erroring out if it can't modify the mtime for root owned directories
    # pipefail to cause the exit status from curl to propagate if it fails
    curl_flags = "fsSL"
    system "/bin/bash -o pipefail -c '/usr/bin/curl -#{curl_flags} #{HOMEBREW_REPO}/tarball/master | /usr/bin/tar xz -m --strip 1'"
  enSorry, try again.
Password:
W_PREFIX}/bin is not in your PATH." unless ENV['PATH'].split(':').include? "#{HOMEBREW_PREFIX}/bin"

ohai "Installation successful!"
ohai "Next steps"

if macos_version < "10.9" and macos_version > "10.6"
  `/usr/bin/cc --version 2> /dev/null` =~ %r[clang-(\d{2,})]
  version = $1.to_i
  puts "Install the #{Tty.white}Command Line Tools for Xcode#{Tty.reset}: https://developer.apple.com/downloads" if version < 425
else
  puts "Install #{Tty.white}Xcode#{Tty.reset}: https://developer.apple.com/xcode" unless File.exist? "/usr/bin/cc"
end

puts "Run `brew help` to get started"Sorry, try again.
Password:
Sorry, try again.
sudo: 3 incorrect password attempts
Imanis-MacBook-Air:~ imanijones$ 

我不知道从哪里开始。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我不确定你是如何运行它的,但是你的输出看起来就像你只是在卷曲原始的git repo。您需要执行完整的ruby安装脚本。

你应该可以粘贴 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 并点击进入。

如果仍然失败,我建议您更新ruby版本并重试。

如果那仍然是STILL失败,请运行: mkdir /usr/local/homebrew && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C /usr/local/homebrew