在 Ubuntu 中安装 HomeBrew 时出现可移植 Ruby 错误

在 Ubuntu 中安装 HomeBrew 时出现可移植 Ruby 错误

我尝试使用以下方法安装 HomeBrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

我得到了这个按摩:

==> Found cURL: /snap/bin/curl
==> Setting HOMEBREW_DEVELOPER to use Git/cURL not in /usr/bin
==> Checking for `sudo` access (which may request your password).
==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/linuxbrew/.linuxbrew/Homebrew

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chown -R ahmed:ahmed /home/linuxbrew/.linuxbrew/Homebrew
==> Downloading and installing Homebrew...
HEAD is now at a6959e4fc Merge pull request #12118 from Homebrew/dependabot/bundler/Library/Homebrew/sorbet-0.5.9155
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:97e639a64dcec285392b53ad804b5334c324f1d2a8bdc2b5087b8bf8051e332f
Warning: Failed to create the file                                                                      
Warning: /home/ahmed/.cache/Homebrew/portable-ruby-2.6.3_2.x86_64_linux.bottle.
Warning: tar.gz.incomplete: Permission denied
                                                                                                     0.0%curl: (23) Failure writing output to destination

==> Downloading https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz
Warning: Failed to create the file                                                                      
Warning: /home/ahmed/.cache/Homebrew/portable-ruby-2.6.3_2.x86_64_linux.bottle.
Warning: tar.gz.incomplete: Permission denied
                                                                                                     0.0%curl: (23) Failure writing output to destination

Error: Failed to download ruby from the following locations:
  - https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:97e639a64dcec285392b53ad804b5334c324f1d2a8bdc2b5087b8bf8051e332f
  - https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz

Do not file an issue on GitHub about this; you will need to figure out for
yourself what issue with your internet connection restricts your access to
GitHub (used for Homebrew updates and binary packages).
Error: Failed to install Homebrew Portable Ruby and cannot find another Ruby 2.6.3!
If there's no Homebrew Portable Ruby available for your processor:
- install Ruby 2.6.3 with your system package manager (or rbenv/ruby-build)
- make it first in your PATH
- try again

Failed during: /home/linuxbrew/.linuxbrew/bin/brew update --force --quiet

有什么解决办法吗?

答案1

我通过从以下位置下载便携式 ruby​​ 找到了解决方案:

 https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz

并将其添加到:

/home/{username}/.cache/Homebrew/

答案2

就我而言,使用 apt 安装 curl 有帮助:

sudo apt-get install curl

尽管如此,我已经使用 snap 安装了 curl。

要将 brew 添加到路径,请使用

echo 'export PATH="/home/linuxbrew/.linuxbrew/bin/brew:$PATH"' >> ~/.bashrc

然后更新 brew run

brew update --auto-upgrade

相关内容