Install Discourse on macOS for development

I’m having some issues with setting up discourse for development on my M1 Mac.

fast_xs and gc_tracer gems fail to install with almost similar errors. I’ve pasted the fast_xs error message below. Could someone help ?

Building native extensions. This could take a while...
ERROR:  Error installing fast_xs:
	ERROR: Failed to build gem native extension.

    current directory: /Users/sisirkoppaka/.gem/ruby/3.2.0/gems/fast_xs-0.8.0/ext/fast_xs
/Users/sisirkoppaka/.rubies/ruby-3.2.0/bin/ruby -I /Users/sisirkoppaka/.rubies/ruby-3.2.0/lib/ruby/site_ruby/3.2.0 extconf.rb
checking for assert.h... yes
creating Makefile

current directory: /Users/sisirkoppaka/.gem/ruby/3.2.0/gems/fast_xs-0.8.0/ext/fast_xs
make DESTDIR\= sitearchdir\=./.gem.20240203-10621-j9d0j7 sitelibdir\=./.gem.20240203-10621-j9d0j7 clean

current directory: /Users/sisirkoppaka/.gem/ruby/3.2.0/gems/fast_xs-0.8.0/ext/fast_xs
make DESTDIR\= sitearchdir\=./.gem.20240203-10621-j9d0j7 sitelibdir\=./.gem.20240203-10621-j9d0j7
compiling fast_xs.c
fast_xs.c:144:39: error: incompatible function pointer types passing 'VALUE (VALUE)' (aka 'unsigned long (unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  144 |         array = rb_rescue(unpack_utf8, self, unpack_uchar, self);
      |                                              ^~~~~~~~~~~~
/Users/sisirkoppaka/.rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/internal/iterator.h:364:62: note: passing argument to parameter 'r_proc' here
  364 | VALUE rb_rescue(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*r_proc)(VALUE, VALUE), VALUE data2);
      |                                                              ^
1 error generated.
make: *** [fast_xs.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/sisirkoppaka/.gem/ruby/3.2.0/gems/fast_xs-0.8.0 for inspection.
Results logged to /Users/sisirkoppaka/.gem/ruby/3.2.0/extensions/arm64-darwin-22/3.2.0-static/fast_xs-0.8.0/gem_make.out```

How was this resolved?

When executing

bundle exec rake db:create
bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate

after starting both Redis and Postgres servers I get the following error.

fe_sendauth: no password supplied
Couldn't create 'discourse_development' database. Please check your configuration.
rake aborted!

When I do this without starting my Redis and Postgres servers I get the following error.

bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate
Couldn't connect to Redis
rake aborted!

Can someone tell me what to do, I am lost.

Thanks

So far I have managed to solve it with the following commands:

bundle config build.fast_xs --with-cflags=\"-Wno-incompatible-pointer-types\"
bundle config build.gc_tracer --with-cflags=\"-Wno-incompatible-pointer-types\"
bundle install