msfdb启动报错”Attempting to start MSF web service…failed”解决方法

1.查看~/.msf4/msf-ws.log,如果是

dyld: lazy symbol binding failed: Symbol not found: _SSL_library_init
Referenced from: /Users/xxxx/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle
Expected in: flat namespace

手动指定ssl包含文件路径并重新安装eventmachine

gem uninstall eventmachine
gem install eventmachine -v '1.2.7' -- --with-cppflags=-I$(brew --prefix openssl)/include

2.再次启动msfdb,发现报错

objc[4443]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[4443]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

这是macOS对objc多线程的限制,修改环境变量解决问题

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES