해결!MAC 홈 brew 설치 오류: Failed to connect to raw.githubusercontent.질문
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
결과 실행 오류 Failed to connect to raw.githubusercontent.com port 443: Connection refused
인터넷에서 오랫동안 찾았더니raw를 알게 되었다.githubusercontent.com이 봉쇄되어 열리지 않기 때문에 Host를 설정하는 방법으로 웹 페이지 원본을 꺼냅니다.
소스는 다음과 같습니다.
#!/usr/bin/ruby
# This script installs to /usr/local only. To install elsewhere (which is
# unsupported) you can untar https://github.com/Homebrew/brew/tarball/master
# anywhere you like.
HOMEBREW_PREFIX = "/usr/local".freeze
HOMEBREW_REPOSITORY = "/usr/local/Homebrew".freeze
HOMEBREW_CACHE = "#{ENV["HOME"]}/Library/Caches/Homebrew".freeze
BREW_REPO = "https://github.com/Homebrew/brew".freeze
# TODO: bump version when new macOS is released
MACOS_LATEST_SUPPORTED = "10.15".freeze
# TODO: bump version when new macOS is released
MACOS_OLDEST_SUPPORTED = "10.13".freeze
# no analytics during installation
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"] = "1"
# get nicer global variables
require "English"
module Tty
module_function
def blue
bold 34
end
def red
bold 31
end
def reset
escape 0
end
def bold(code = 39)
escape "1;#{code}"
end
def underline
escape "4;39"
end
def escape(code)
"\033[#{code}m" if STDOUT.tty?
end
end
class Array
def shell_s
cp = dup
first = cp.shift
cp.map { |arg| arg.gsub " ", "\\ " }.unshift(first).join(" ")
end
end
def ohai(*args)
puts "#{Tty.blue}==>#{Tty.bold} #{args.shell_s}#{Tty.reset}"
end
def warn(warning)
puts "#{Tty.red}Warning#{Tty.reset}: #{warning.chomp}"
end
def system(*args)
abort "Failed during: #{args.shell_s}" unless Kernel.system(*args)
end
def sudo(*args)
args.unshift("-A") unless ENV["SUDO_ASKPASS"].nil?
ohai "/usr/bin/sudo", *args
system "/usr/bin/sudo", *args
end
def getc
system "/bin/stty raw -echo"
if STDIN.respond_to?(:getbyte)
STDIN.getbyte
else
STDIN.getc
end
ensure
system "/bin/stty -raw echo"
end
def wait_for_user
puts
puts "Press RETURN to continue or any other key to abort"
c = getc
# we test for \r and
because some stuff does \r instead
abort unless (c == 13) || (c == 10)
end
class Version
include Comparable
attr_reader :parts
def initialize(str)
@parts = str.split(".").map(&:to_i)
end
def <=>(other)
parts <=> self.class.new(other).parts
end
def to_s
parts.join(".")
end
end
def macos_version
@macos_version ||= Version.new(`/usr/bin/sw_vers -productVersion`.chomp[/10\.\d+/])
end
def should_install_command_line_tools?
if macos_version > "10.13"
!File.exist?("/Library/Developer/CommandLineTools/usr/bin/git")
else
!File.exist?("/Library/Developer/CommandLineTools/usr/bin/git") ||
!File.exist?("/usr/include/iconv.h")
end
end
def user_only_chmod?(path)
return false unless File.directory?(path)
mode = File.stat(path).mode & 0777
# u = (mode >> 6) & 07
# g = (mode >> 3) & 07
# o = (mode >> 0) & 07
mode != 0755
end
def chmod?(path)
File.exist?(path) && !(File.readable?(path) && File.writable?(path) && File.executable?(path))
end
def chown?(path)
!File.owned?(path)
end
def chgrp?(path)
!File.grpowned?(path)
end
# USER isn't always set so provide a fall back for the installer and subprocesses.
ENV["USER"] ||= `id -un`.chomp
# Invalidate sudo timestamp before exiting (if it wasn't active before).
Kernel.system "/usr/bin/sudo -n -v 2>/dev/null"
at_exit { Kernel.system "/usr/bin/sudo", "-k" } unless $CHILD_STATUS.success?
# The block form of Dir.chdir fails later if Dir.CWD doesn't exist which I
# guess is fair enough. Also sudo prints a warning message for no good reason
Dir.chdir "/usr"
####################################################################### script
if RUBY_PLATFORM.to_s.downcase.include?("linux")
abort < MACOS_LATEST_SUPPORTED || macos_version < MACOS_OLDEST_SUPPORTED
who = "We"
if macos_version > MACOS_LATEST_SUPPORTED
what = "pre-release version"
elsif macos_version < MACOS_OLDEST_SUPPORTED
who << " (and Apple)"
what = "old version"
else
return
end
ohai "You are using macOS #{macos_version.parts.join(".")}."
ohai "#{who} do not provide support for this #{what}."
puts <= "10.13"
ohai "Searching online for the Command Line Tools"
# This temporary file prompts the 'softwareupdate' utility to list the Command Line Tools
clt_placeholder = "/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
sudo "/usr/bin/touch", clt_placeholder
clt_label_command = "/usr/sbin/softwareupdate -l | " \
"grep -B 1 -E 'Command Line Tools' | " \
"awk -F'*' '/^ *\\*/ {print $2}' | " \
"sed -e 's/^ *Label: //' -e 's/^ *//' | " \
"sort -V | " \
"tail -n1"
clt_label = `#{clt_label_command}`.chomp
unless clt_label.empty?
ohai "Installing #{clt_label}"
sudo "/usr/sbin/softwareupdate", "-i", clt_label
sudo "/bin/rm", "-f", clt_placeholder
sudo "/usr/bin/xcode-select", "--switch", "/Library/Developer/CommandLineTools"
end
end
# Headless install may have failed, so fallback to original 'xcode-select' method
if should_install_command_line_tools? && STDIN.tty?
ohai "Installing the Command Line Tools (expect a GUI popup):"
sudo "/usr/bin/xcode-select", "--install"
puts "Press any key when the installation has completed."
getc
sudo "/usr/bin/xcode-select", "--switch", "/Library/Developer/CommandLineTools"
end
abort <&1` =~ /license/ && !$CHILD_STATUS.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
ohai "Downloading and installing Homebrew..."
Dir.chdir HOMEBREW_REPOSITORY do
# 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", BREW_REPO
system "git", "config", "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*"
# ensure we don't munge line endings on checkout
system "git", "config", "core.autocrlf", "false"
system "git", "fetch", "origin", "master:refs/remotes/origin/master",
"--tags", "--force"
system "git", "reset", "--hard", "origin/master"
system "ln", "-sf", "#{HOMEBREW_REPOSITORY}/bin/brew", "#{HOMEBREW_PREFIX}/bin/brew"
system "#{HOMEBREW_PREFIX}/bin/brew", "update", "--force"
end
warn "#{HOMEBREW_PREFIX}/bin is not in your PATH." unless ENV["PATH"].split(":").include? "#{HOMEBREW_PREFIX}/bin"
ohai "Installation successful!"
puts
# Use the shell's audible bell.
print "\a"
# Use an extra newline and bold to avoid this being missed.
ohai "Homebrew has enabled anonymous aggregate formulae and cask analytics."
puts <
로컬에서 새로 작성한 텍스트에 붙여넣고 이름:brewinstall.rb
터미널에 입력
ruby brew_install.rb
이 때 대응하는 파일을 선택하여 설치하면brew의 다운로드 & 설치를 완성할 수 있습니다
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.