在M1 MacBook上运行Ventura 13.2上的Ruby on Rails。

huangapple go评论70阅读模式
英文:

Running Ruby on Rails on M1 MacBook Running Ventura 13.2

问题

I am trying to run rails on my computer but am being prompted to install the pg gem.

我正在尝试在我的计算机上运行Rails,但被提示安装pg gem。

I am using a MacBook running Ventura 13.2.1 with the M1 chip.

我正在使用一台搭载M1芯片的运行Ventura 13.2.1的MacBook。

When I try to install the gem, I get this error:

当我尝试安装这个gem时,我遇到了以下错误:

英文:

I am trying to run rails on my computer but am being prompted to install the pg gem.

I am using a MacBook running Ventura 13.2.1 with the M1 chip.

When I try to install the gem, I get this error:

bundle install --gemfile /Users/username/demo/demoapp/Gemfile
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using erubi 1.12.0
Using public_suffix 5.0.1
Using bindex 0.8.1
Using msgpack 1.7.1
Using bundler 2.4.14
Using mini_mime 1.1.2
Using matrix 0.4.2
Using io-console 0.6.0
Using date 3.3.3
Using thor 1.2.2
Using zeitwerk 2.6.8
Using regexp_parser 2.8.1
Using rexml 3.2.5
Using rubyzip 2.3.2
Using timeout 0.4.0
Using marcel 1.0.2
Using method_source 1.0.0
Using addressable 2.8.4
Using bootsnap 1.16.0
Using tzinfo 2.0.6
Using net-protocol 0.2.1
Using websocket 1.2.9
Using minitest 5.18.1
Using builder 3.2.4
Using websocket-extensions 0.1.5
Using i18n 1.14.1
Using net-smtp 0.3.3
Using activesupport 7.0.5.1
Using websocket-driver 0.7.5
Using racc 1.7.1
Using crass 1.0.6
Using rack 2.2.7
Using globalid 1.1.0
Using activemodel 7.0.5.1
Using nio4r 2.5.9
Using net-imap 0.3.6
Using nokogiri 1.15.2 (arm64-darwin)
Using rack-test 2.1.0
Using activejob 7.0.5.1
Using activerecord 7.0.5.1
Using puma 5.6.6
Using sprockets 4.2.0
Using net-pop 0.1.2
Using selenium-webdriver 4.10.0
Using reline 0.3.5
Using rails-dom-testing 2.0.3
Using loofah 2.21.3
Using mail 2.8.1
Using xpath 3.2.0
Using webdrivers 5.2.0
Using irb 1.7.0
Using rails-html-sanitizer 1.6.0
Using capybara 3.39.2
Using actionview 7.0.5.1
Using debug 1.8.0
Using actionpack 7.0.5.1
Using jbuilder 2.11.5
Using actioncable 7.0.5.1
Using railties 7.0.5.1
Using actionmailer 7.0.5.1
Using sprockets-rails 3.4.2
Using activestorage 7.0.5.1
Using stimulus-rails 1.2.1
Using turbo-rails 1.4.0
Using importmap-rails 1.2.1
Using web-console 4.2.0
Using actiontext 7.0.5.1
Using actionmailbox 7.0.5.1
Using rails 7.0.5.1
Installing pg 1.5.3 with native extensions
Bundler::DirectoryRemovalError: Could not delete previous installation of `/opt/homebrew/lib/ruby/gems/3.2.0/gems/pg-1.5.3`.
The underlying error was Errno::EACCES: Permission denied @ apply2files -
/opt/homebrew/lib/ruby/gems/3.2.0/gems/pg-1.5.3/misc/openssl-pg-segfault.rb, with backtrace:
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2342:in `unlink'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2342:in `block in remove_file'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2347:in `platform_support'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2341:in `remove_file'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2330:in `remove'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:1470:in `block in remove_entry'
/opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2389:in `block (2 levels) in
postorder_traverse'
/opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2389:in `block (2 levels) in
postorder_traverse'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2393:in `postorder_traverse'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2388:in `block in postorder_traverse'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2387:in `each'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2387:in `postorder_traverse'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2388:in `block in postorder_traverse'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2387:in `each'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:2387:in `postorder_traverse'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:1468:in `remove_entry'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/vendor/fileutils/lib/fileutils.rb:1383:in `remove_entry_secure'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler.rb:332:in `rm_rf'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:111:in `strict_rm_rf'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:19:in `install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/source/rubygems.rb:201:in `install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:54:in `install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:62:in `apply_func'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:57:in `block in process_queue'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in `loop'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in `process_queue'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

Bundler Error Backtrace:
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:115:in `rescue in strict_rm_rf'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:110:in `strict_rm_rf'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:19:in `install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/source/rubygems.rb:201:in `install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:54:in `install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:62:in `apply_func'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:57:in `block in process_queue'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in `loop'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in `process_queue'
  /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing pg (1.5.3), and Bundler cannot continue.

In Gemfile:
  pg

答案1

得分: 2

听起来像是本地权限策略阻止您对homebrew进行任何操作,通常根本错误是Errno::EACCES: 权限被拒绝 @ apply2files -

https://stackoverflow.com/questions/61899041/macos-permission-denied-apply2files-usr-local-lib-node-modules-expo-cli-n

英文:

Sounds like a local permission policy is blocking you from doing anything with homebrew, typically The underlying error was Errno::EACCES: Permission denied @ apply2files -

https://stackoverflow.com/questions/61899041/macos-permission-denied-apply2files-usr-local-lib-node-modules-expo-cli-n

huangapple
  • 本文由 发表于 2023年6月30日 04:16:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76584360.html
  • apple-m1
  • ruby-on-rails