Miglior metodo di installazione dev per eseguire su macOS?

Qual è l’attuale approccio e la metodologia consigliata per installare Discourse su macOS a scopo di sviluppo? Ho provato a seguire le istruzioni ufficiali documentate su GitHub nell’articolo - Guida per principianti all’installazione di Discourse su macOS per lo sviluppo, ma non funziona.

Sono stati segnalati 3 errori durante il tentativo di installare il gem cppjieba_rb-0.3.3.

Qualcun altro ha riscontrato questo problema di recente?

Qual è l’output di gem install cppjieba_rb?

~/Developer/localhost/discourse on  master sudo gem install cppjieba_rb -v '0.3.3' --source 'https://rubygems.org/'             at 17:13:33
Password:
Building native extensions. This could take a while...
ERROR:  Error installing cppjieba_rb:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20191021-73798-k500fk.rb extconf.rb
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb
make "DESTDIR="
compiling cppjieba_rb.c
compiling internal.cc
In file included from internal.cc:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h:413:31: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
                              ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h:414:35: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                  ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h:414:55: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                                      ^

In file included from internal.cc:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:2111:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/intern.h:56:19: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);
                  ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/intern.h:56:36: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);
                                   ^~~~~~~~~
In file included from internal.cc:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/Jieba.hpp:4:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/QuerySegment.hpp:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/DictTrie.hpp:13:
/Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/deps/limonp/StringUtil.hpp:87:70: warning: 'ptr_fun<unsigned int, bool>' is deprecated [-Wdeprecated-declarations]
  s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))));
                                                                     ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1097:1: note: 'ptr_fun<unsigned int, bool>' has been explicitly marked deprecated here
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1101:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1090:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
In file included from internal.cc:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/Jieba.hpp:4:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/QuerySegment.hpp:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/DictTrie.hpp:13:
/Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/deps/limonp/StringUtil.hpp:92:61: warning: 'ptr_fun<unsigned int, bool>' is deprecated [-Wdeprecated-declarations]
  s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))).base(), s.end());
                                                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1097:1: note: 'ptr_fun<unsigned int, bool>' has been explicitly marked deprecated here
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1101:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1090:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
In file included from internal.cc:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/Jieba.hpp:4:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/QuerySegment.hpp:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/DictTrie.hpp:13:
/Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/deps/limonp/StringUtil.hpp:101:70: warning: 'bind2nd<std::__1::equal_to<char>, char>' is deprecated [-Wdeprecated-declarations]
  s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::bind2nd(std::equal_to<char>(), x))));
                                                                     ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1079:1: note: 'bind2nd<std::__1::equal_to<char>, char>' has been explicitly marked deprecated here
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1101:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1090:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
In file included from internal.cc:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/Jieba.hpp:4:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/QuerySegment.hpp:8:
In file included from /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/include/cppjieba/DictTrie.hpp:13:
/Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3/ext/cppjieba_rb/../cppjieba/deps/limonp/StringUtil.hpp:106:61: warning: 'bind2nd<std::__1::equal_to<char>, char>' is deprecated [-Wdeprecated-declarations]
  s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::bind2nd(std::equal_to<char>(), x))).base(), s.end());
                                                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1079:1: note: 'bind2nd<std::__1::equal_to<char>, char>' has been explicitly marked deprecated here
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1101:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1090:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
6 warnings and 3 errors generated.
make: *** [internal.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/cppjieba_rb-0.3.3 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/cppjieba_rb-0.3.3/gem_make.out

Sei riuscito a risolverlo? Ho riscontrato lo stesso problema quando sono passato da bash a zsh e ho dimenticato di configurare rbenv. Non appena ho ricominciato a usare rbenv, tutto è tornato alla normalità.

Il Ruby di sistema su macOS sembra presentare problemi di tanto in tanto.

Non sono riuscito a risolvere il problema. Hai fatto altro oltre a installare rbenv come parte dello script di installazione delle dipendenze di Discourse? Io ho fatto solo quello, perché non ci sono altre istruzioni.

Il mio ambiente di sviluppo è stato configurato molto tempo fa, quindi non ne sono sicuro. Non credo di aver fatto altro in quel momento, ma forse qualcosa è cambiato in macOS da allora.

Immagino tu possa verificare se rbenv è configurato… se esegui nano ~/.bash_profile dovresti vedere qualcosa di simile a questo:

# carica rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init - --no-rehash)"

Puoi anche controllare rbenv versions per vedere quale versione è attualmente selezionata (è quella con l’asterisco accanto). Se è system, vorrai cambiarla… la 2.6.1 funziona bene per me. (rbenv install 2.6.1 e poi rbenv global 2.6.1)