Best dev installation method for running on macOS?

What is the current thinking and approach to installing Discourse on macOS for development purposes? I’ve tried installing via the official GitHub documented instructions in the article - Beginners Guide to Install Discourse on macOS for Development but that doesn’t work.

3 errors are reported when trying to install the cppjieba_rb-0.3.3 gem.

Anyone else experienced this recently?

1 Like

What is the output of gem install cppjieba_rb?

3 Likes
~/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

Did you figure this out? I hit the same issue when I switched from bash to zsh and forgot to setup rbenv. Once I was using rbenv again all went back to normal.

The system Ruby on macOS seems to be problematic from time to time.

2 Likes

I didn’t figure it out. Did you do more than just install rbenv as part of the Discourse Dependency Install script? That’s all I did, because there aren’t any other instructions.

My dev environment was setup a long time ago, so I’m not sure. I don’t suspect I did anything more at the time, but maybe something changed in macOS since then.

I guess you can check if rbenv is setup… if you run nano ~/.bash_profile you should see something like this:

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

You can also check rbenv versions to see which version is currently selected (it’s the one with the asterisk next to it). If it’s system you’ll want to change it… 2.6.1 is working fine for me. (rbenv install 2.6.1 and then rbenv global 2.6.1)

3 Likes