[Ruby] I can't install puma on Mac [Rails, etc.]

Rails can't be installed because of puma. If you can't install without sqlite, you can solve it by installing sqlite from brew.

macOS Catalina 10.15.6 ruby 2.6.5 gem 3.0.3 puma 4.3.5

Isn't xCode installed for a similar question? There was an answer That doesn't help at hand.

Error message (click to expand)
gem install puma -v '4.3.5' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing puma:
	ERROR: Failed to build gem native extension.

    current directory: /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5/ext/puma_http11
/Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/bin/ruby -I /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20200810-80454-doo97b.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
checking for DTLS_method() in openssl/ssl.h... yes
checking for TLS_server_method() in openssl/ssl.h... yes
checking for SSL_CTX_set_min_proto_version in openssl/ssl.h... yes
creating Makefile

current directory: /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5/ext/puma_http11
make "DESTDIR=" clean

current directory: /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
ext/puma_http11/http11_parser.c:44:18: warning: unused variable 'puma_parser_en_main' [-Wunused-const-variable]
static const int puma_parser_en_main = 1;
1 warning generated.
compiling io_buffer.c
compiling mini_ssl.c
mini_ssl.c:145:7: warning: unused variable 'min' [-Wunused-variable]
  int min, ssl_options;
mini_ssl.c:299:40: warning: function 'raise_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
void raise_error(SSL* ssl, int result) {
2 warnings generated.
compiling puma_http11.c
puma_http11.c:203:22: error: implicitly declaring library function 'isspace' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
  while (vlen > 0 && isspace(value[vlen - 1])) vlen--;
puma_http11.c:203:22: note: include the header <ctype.h> or explicitly provide a declaration for 'isspace'
1 error generated.
make: *** [puma_http11.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5 for inspection.
Results logged to /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/puma-4.3.5/gem_make.out

When I was googled, I found an issue, and it seems that the default parameters on the Mac side changed and I could not compile with gcc well. https://github.com/puma/puma/issues/2304 As a workaround, deal with it as follows.

gem install puma:4.3.5 -- --with-cflags="-Wno-error=implicit-function-declaration

Recommended Posts

[Ruby] I can't install puma on Mac [Rails, etc.]
I can't install rails on my mac
Install Ruby / Rails on Mac M1 Big Sur 2021-01
[Ruby on Rails] yarn install --check-files
Ruby on Rails installation method [Mac edition]
[Ruby on Rails] Let's build an environment on mac
Ruby on Rails development environment construction on M1 Mac
[Ruby on Rails] How to install Bootstrap in Rails
I made a portfolio with Ruby On Rails
Install gradle on mac
Install Java on Mac
Install Ruby on Ubuntu 20.04
Mac Rails Install Error
Ruby on Rails Elementary
Ruby on Rails basics
Install openjdk11 on mac
Ruby On Rails Association
Install OpenJDK 8 on mac
I can't overwrite information on columns in rails console ...
[Environment construction Mac] Ruby on Rails (+ Webpacker handles errors)
I struggled with pip install on an M1 Mac
Ruby on rails learning record -2020.10.03
Install Sidekiq pro on Rails
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Ruby on Rails config configuration
Ruby on Rails basic learning ①
[Ruby on Rails] about has_secure_password
Ruby on rails learning record-2020.10.07 ②
Install Rails on macOS Catalina
Commentary on partial! --Ruby on Rails
Install Ruby 2.7 on RHEL 8 (AppStream)
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Install Ruby 2.7 on CentOS 7 (SCL)
Ruby on rails learning record -2020.10.06
Install tomcat + eclipse on mac
Ruby on Rails validation summary
Ruby on Rails Basic Memorandum
Install Ruby on Sakura's VPS
I changed the Ruby version and now I can't bundle install
I tried installing Ruby on Rails related plugin with vim-plug
Beginner Ruby on Rails What I learned is being summarized
Install Ruby on MSYS2 with pacman
Ruby on Rails Overview (Beginner Summary)
[Ruby on Rails] Read try (: [],: key)
Where I was interested in Progate's Ruby on Rails course [params]
Ruby on Rails variable, constant summary
[Ruby on Rails] Introduced paging function
I want to add a browsing function with ruby on rails
Progate Ruby on Rails5 Looking Back
Install Ruby 2.5 on CentOS 7 using SCL
How to use Ruby on Rails
I can't install lombok with Gradle.
[Ruby on Rails] Add / Remove Columns
Ruby on Rails Japanese-English support i18n
(Ruby on Rails6) "Erase" posted content
[Ruby on Rails] CSV output function
Ruby on Rails 6.0 environment construction memo