macOS에서 개발용 Discourse 설치하기

개발 환경에서는 여기서 업그레이드를 수행하지 않습니다.

로버트 씨, 답변해 주셔서 감사합니다. 개발 환경에서 업그레이드를 수행하려면 'git pull’만으로도 충분한가요?

1개의 좋아요

네, 하지만 젬(gems)과 마이그레이션도 잊지 마세요:

git pull
bundle install
rake db:migrate
2개의 좋아요

스크립트에 문제가 있는 것 같습니다. brew 설치가 실패하네요.
(새로 산 Mac Air M2에서 실행 중입니다)

brew를 직접 설치한 후에는 모든 것이 정상적으로 진행되었습니다 :slight_smile:

참고로 스크립트는 Ruby 3.1.3을 설치한 후 bundle exec가 3.2.1을 사용하지 않는다고 경고합니다 :smiley:

[Warning] Discourse recommends developing using Ruby v3.2.1 or above. You are using v3.1.3.

2개의 좋아요

이제 더 이상 사실이 아닙니다! :partying_face:

3개의 좋아요

알 수 없는 이유로 Ruby를 설치할 수 없습니다. 계속 다음 오류가 발생합니다:

BUILD FAILED (macOS 12.5.1 using ruby-build 20230309)

Inspect or clean up the working tree at /var/folders/f6/95l6wylj4d11_jyvyp7r9yd40000gn/T/ruby-build.20230320012216.80048.RdOmWC
Results logged to /var/folders/f6/95l6wylj4d11_jyvyp7r9yd40000gn/T/ruby-build.20230320012216.80048.log

Last 10 log lines:
	Check ext/psych/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
Generating RDoc documentation
/private/var/folders/f6/95l6wylj4d11_jyvyp7r9yd40000gn/T/ruby-build.20230320012216.80048.RdOmWC/ruby-3.2.1/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych

run with --debug for full backtrace
make: *** [rdoc] Error 1
failed

이 문제를 해결하는 데 도움을 주실 수 있나요?

1개의 좋아요

저도 macOS 13.2.1에서 동일한 문제가 발생합니다.

이 페이지는 이 오류 메시지(의 일부)를 검색했을 때 Google에서 유일한 결과입니다. 따라서 다른 사람이 이 오류를 다시 마주할 경우를 대비해 공유합니다.

저는 오늘 Ruby(3.2.1), Rails(7.0.4.3) 및 mini_racer(0.6.3)를 포함한 모든 Gemfile 의존성을 최신 버전으로 업그레이드한 후 rails s를 실행하다가 이 문제를 겪었습니다.

이 GitHub 댓글의 제안을 따름으로써 해결되었습니다: .../3.2.0/gems/mini_racer-0.6.3/ext/mini_racer_extension 디렉터리 안에서 make를 실행하고, 생성된 mini_racer_extension.bundle을 .../3.2.0/extensions/x86_64-darwin-22/3.2.0/mini_racer-0.6.3 경로로 복사하면 됩니다.

드디어 빌드 오류를 어떻게든 성공적으로 해결했습니다(무엇을 했는지 기록을 안 해서…:thinking:), 하지만 이제 다음 단계에서 막혀 있습니다:

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

bundle install 실행 중입니다.

수정:
오류 위에 제시된 지침을 따르면서 해결되었습니다:

If you need to have postgresql@13 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/postgresql@13/bin:$PATH"' >> ~/.zshrc

For compilers to find postgresql@13 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/postgresql@13/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/postgresql@13/include"

For pkg-config to find postgresql@13 you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/postgresql@13/lib/pkgconfig"

하지만 정확히 어느 명령어를 실행해야 하는지 모르겠습니다! :sweat_smile:

1개의 좋아요

회사 노트북에서 권한 문제로 인해 설치 스크립트를 수동으로 진행하며 항목을 하나씩 처리해야 하는 상황입니다. gem update --system을 실행하려고 하면 다음과 같은 오류가 발생합니다:

sh-3.2# gem update --system
Updating rubygems-update
Fetching rubygems-update-3.4.12.gem
Successfully installed rubygems-update-3.4.12
Parsing documentation for rubygems-update-3.4.12
Installing ri documentation for rubygems-update-3.4.12
Installing darkfish documentation for rubygems-update-3.4.12
Done installing documentation for rubygems-update after 158 seconds
Parsing documentation for rubygems-update-3.4.12
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.4.12
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1387:in `initialize'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1387:in `open'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1387:in `block in copy_file'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1386:in `open'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1386:in `copy_file'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:492:in `copy_file'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:860:in `block in install'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1558:in `block in fu_each_src_dest'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1574:in `fu_each_src_dest0'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1556:in `fu_each_src_dest'
	/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:856:in `install'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/commands/setup_command.rb:267:in `block (2 levels) in install_executables'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/commands/setup_command.rb:251:in `chdir'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/commands/setup_command.rb:251:in `block in install_executables'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/commands/setup_command.rb:248:in `each'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/commands/setup_command.rb:248:in `install_executables'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/commands/setup_command.rb:165:in `execute'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/command.rb:327:in `invoke_with_build_args'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/command_manager.rb:252:in `invoke_command'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/command_manager.rb:192:in `process_args'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/command_manager.rb:150:in `run'
	/Library/Ruby/Gems/2.6.0/gems/rubygems-update-3.4.12/lib/rubygems/gem_runner.rb:51:in `run'
	setup.rb:33:in `<main>'

이 문제를 해결하는 방법에 대해 아이디어가 있을까요?

1개의 좋아요

M1/M2 Apple 칩을 사용하시나요? 먼저 brew를 통해 Ruby 3.2.x를 설치하여 시스템 기본 버전으로 설정하는 것이 좋습니다. 그런 다음 Apple Silicon 환경에서는 .zshrc 파일에 아래 코드를 추가하세요.

  if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
     export PATH=/opt/homebrew/opt/ruby/bin:$PATH
     export PATH=`gem environment gemdir`/bin:$PATH
  fi

Mac OS X에는 시스템 Ruby 2.x가 기본으로 포함되어 있어, 이 버전이 환경 설치 스크립트를 망가뜨릴 수 있기 때문입니다.

또한 서비스 시작에 문제가 있다면 다음과 같은 명령을 실행해 보세요:

  brew services restart postgresql@13
  brew services restart redis

저는 이렇게 하니 정상적으로 작동했습니다.

2개의 좋아요

안녕하세요, 여러분! 여기 설치 관련 게시물을 꾸준히 보고 있었고, 공유해 주신 팁들이 MacOS M1 설치 과정에서 겪었던 여러 문제를 해결하는 데 큰 도움이 되었습니다.

현재 마지막 Bootstrap 단계에서 막혀 있습니다:

bundle exec rails server

위 명령어는 저에게 잘 작동했고, localhost:3000에서 무언가를 확인했으며 관리자 사용자도 등록할 수 있었습니다. 하지만 bin/ember-cli를 실행한 후 다음과 같은 예외가 발생했습니다:

$ bin/ember-cli
warning Resolution field "unset-value@2.0.1" is incompatible with requested version "unset-value@^1.0.0"
patch-package 8.0.0
Applying patches...
@ember/jquery@2.0.0 ✔
babel-plugin-debug-macros@0.3.4 ✔
content-tag@1.1.2 ✔
ember-source@3.28.12 ✔
ember-this-fallback@0.4.0 (1 deprecation-name) ✔
ember-this-fallback@0.4.0 (2 themes) ✔
virtual-dom@2.1.1 ✔
WARNING: Ember CLI v5.0.0 is not tested against Node v21.0.0. See "https://github.com/ember-cli/ember-cli/blob/master/docs/node-support.md" to find out which version of Node is best to use.
(node:22167) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Could not `import('file:///Users/myuser/discourse/app/assets/javascripts/discourse/ember-cli-build.js')`: Cannot read properties of undefined (reading 'indexOf')

스택 트레이스 및 에러 리포트: /var/folders/4l/ksznzcp17sg1wjyq7mmfzfkc0000gn/T/error.dump.b499a1d1d9b275ada33629ea1a84760d.log

무엇을 놓치고 있는 건가요?

현재 node를 제거하고 brew를 통해 node@20을 설치한 후 bin/ember-cli를 실행할 수 있었습니다.

1개의 좋아요

이 단계에서 이 오류가 발생합니다.

Error: Could not symlink bin/c_rehash
Target /opt/homebrew/bin/c_rehash
is a symlink belonging to openssl@3. You can unlink it:
  brew unlink openssl@3

To force the link and overwrite all conflicting files:
  brew link --overwrite openssl@1.1

To list all files that would be deleted:
  brew link --overwrite --dry-run openssl@1.1
failed

그리고 그 단계에서는 이 오류가 발생합니다.

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.4.13) required by your /Users/Desktop/discourse/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.4.13`
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
	from /usr/bin/bundle:23:in `<main>'

어떻게 진행해야 할지 안내해 주실 분 있나요? 처음 하는 것입니다. @Arkshine

안타깝게도 저는 macOS 컴퓨터를 가지고 있지 않습니다. 스크립트가 Windows/Linux에서는 정상적으로 작동한다는 것은 알고 있지만, macOS에서는 테스트할 수 없습니다.

brew link --overwrite openssl@1.1을 실행한 후 스크립트를 다시 실행해 보셨나요? 하지만 이 라인에서 다시 중단될 가능성이 높습니다.

이 개발 환경에서 환경 변수를 설정하는 방법을 아시는 분 계신가요? SSO를 작동시키고 싶은데 CORS를 활성화해야 하는 것 같습니다. app.yml 파일에서 설정해야 한다는 내용을 읽었는데, 이 환경에는 해당 파일이 없네요. site_settings DB 테이블에 설정할 수 있을까요? Discourse 개발을 처음 시작해서 죄송합니다.

안녕하세요 @Plabforum,

저도与您과 동일한 두 가지 오류가 발생하고 있습니다. 혹시 해결하셨나요?

도움이 될 만한 조언이 있다면 알려주시면 감사하겠습니다.

죄송합니다, 좋은 소식은 없습니다. 사실 그 이후로 포기했습니다.

불편을 드려 죄송합니다. 실제로는 다음 방법으로 openssl@3을 unlink하여 이 문제를 해결할 수 있었습니다:

brew unlink openssl@3

그 후 openssl@1.1을 link했습니다.

brew link --overwrite openssl@1.1

스크립트를 다시 실행했을 때 오류 없이 완료되었습니다(첫 번째 실행 시 설치된 항목에 대한 몇 가지 경고가 표시되었습니다).

2개의 좋아요

이 토픽의 설명에 따라 Macbook에 개발용 Discourse를 설치하는 데 성공한 것 같습니다. 추가 질문이 두 가지 있습니다.

  1. bundle exec rake autospec을 실행할 때 경고와 실패가 발생했습니다. 이것이 걱정스러운가요? 제 설치 환경은 예상대로 작동하며 관리자 섹션에서 오류가 표시되지 않습니다.

  2. 부끄러운 질문을 드릴 수 있어 미리 사과드립니다. (이런 유형의 솔루션/서버에 완전히 초보입니다.) 서버를 사용하려면 매번 bundle exec rails server, bin/ember-cli, mailhog를 실행해야 하나요? 그리고 서버를 종료하고 싶을 때는 어떻게 해야 하나요?

지원해 주셔서 감사합니다!