[Solved] Unable to Installing Ruby 2.6.6 or 2.6.7 on Mac using rbenv
Article
Mashpy Rahman
I tried to install ruby 2.6.6 or 2.6.7 on mac using rbenv but getting error -
Last 10 log lines: compiling ../.././ext/psych/yaml/dumper.c compiling ../.././ext/psych/yaml/reader.c compiling ../.././ext/psych/yaml/emitter.c compiling ../.././ext/psych/yaml/parser.c linking shared-object date_core.bundle 5 warnings generated. linking shared-object zlib.bundle 1 warning generated. linking shared-object psych.bundle make: *** [build-ext] Error 2
Solution 1:
Run "rbenv install --list-all". If 2.6.6 is missing then reinstall again from the beginning. Add rbenv to bash so that it loads every time you open the terminal.
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc source ~/.zshrc
Then install Ruby -
rbenv install 2.6.6 rbenv global 2.6.6 ruby -v
Solution 2:
$ export warnflags=-Wno-error=implicit-function-declaration $ rbenv install 2.6.7
or
$ CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.6.7
But this can impact native extension like mysql. On that case you can run -
gem install [GEMNAME] -- --with-cflags="-Wno-error=implicit-function-declaration"
Thank you for reading the article.