puma gem - Failed to build gem native extension

puma gem - Failed to build gem native extension



I was getting the following error while installing puma gem




11 Answers
11



Try the following


gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include
bundle install



You can also specify the gem version, like the following:


gem install puma -v '2.11.3' -- --with-cppflags=-I/usr/local/opt/openssl/include





I'm on El Capitian OSX 10.11.2. When I first did gem install puma - it gave me ERROR: Failed to build gem native extension. I then tried your send command (with puma version "2.9.1") and it seems to have worked with no errors! (yay!). Please would you be able to explain what this command mean? (I'm curious now as to why this command solves the problem). Thanks for your help!!!
– Atlas7
Jan 20 '16 at 14:23


gem install puma


ERROR: Failed to build gem native extension





Worked for me on El Capitan, no idea why though.
– Senthe
Mar 31 '16 at 10:07





install special version of puma that what i needed exactly
– Mikhail Morgunov
May 10 '16 at 15:55





On El Capitan, run gem install puma -v '2.11.2' -- --with-opt-dir=/usr/local/opt/openssl. This works fine for me.
– Kevin R.
Jun 28 '16 at 14:27



gem install puma -v '2.11.2' -- --with-opt-dir=/usr/local/opt/openssl





gem install puma -v '3.6.0' -- --with-opt-dir=/usr/local/opt/openssl worked on seirra
– mahi
Mar 23 '17 at 16:08


gem install puma -v '3.6.0' -- --with-opt-dir=/usr/local/opt/openssl



I'm on OS X 10.12.4 and the comment @mahi added worked for me:


gem install puma -v '3.6.0' -- --with-opt-dir=/usr/local/opt/openssl





worked for OSX 10.13.3
– carlmyerflor
Mar 17 at 4:05





not working in Ubuntu 18.04
– Ameen
Sep 21 at 14:25





@Ameen what isn't working? Are you getting the same error as above or a different error? Also note this is for OS X 10.12.4 not Ubuntu. There is a good chance the openssl library is somewhere else in Ubuntu.
– Beartech
Sep 22 at 0:15



I had similar issue on OSx El Capitan. In order to fix the issue I had to do:


brew install openssl
brew link --force openssl





This will may trigger a warning and will not work Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
– hatenine
Mar 15 '17 at 10:41



Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib



I've run into a similar error under Mac OS X 10.10.



Details in the mkmf.log showed that this was due to:


mkmf.log



Agreeing to the Xcode/iOS license requires admin privileges, please
re-run as root via sudo.



Which was caused by the installation of a new version of Xcode.
This was easily solved by accepting the Xcode license from Apple:


sudo xcodebuild -license



Hope this might help someone in the future ;-)



It could be an open ssl error


gem install puma -v 2.11.2 -- --with-opt-dir=/usr/local/opt/openssl





This worked for me on High Sierra
– Ryan Morlok
Nov 29 '17 at 20:20



When using bundler and homebrew:


$ bundle config build.puma --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install



I copied and adapted this answer from Lloeki here: https://stackoverflow.com/a/31516586/704499



I had to do this beforehand: sudo apt-get install libgmp3-dev


sudo apt-get install libgmp3-dev





I tried sudo apt-get install libssl-dev then installed gem install puma -v '3.1.0' but it didn't worked. Then I sudo apt-get install libgmp3-dev then installed gem it worked. Thanks @matsko
– sagar junnarkar
Mar 31 '16 at 9:24


sudo apt-get install libssl-dev


gem install puma -v '3.1.0'


sudo apt-get install libgmp3-dev



libssl1.0-dev installing helped to me. Try


apt-get install libssl1.0-dev



and then


gem install puma





Or apt install libssl-dev for a more generic dev version.
– Daniel-KM
Sep 1 at 11:44


apt install libssl-dev



The gem is looking for ssl libraries. So we have to provide the path to the lib containing the ssl lib



e.g. /usr/share/openssl



In my case the the ssl lib "libcrypto" was in /usr/local/lib. So let's pass /usr/local to it (excluding lib word).



For gem install


gem install puma -- --with-opt-dir=/usr/local



For bundle install



notice the name build.puma. where puma is the name of the gem.



The build config command adds the following to ~/.bundle/config



Run brew info openssl and follow the instructions there. Do not try to --force link the latest openssl with the one that comes installed with OSX by default. (0.9.8)


brew info openssl


--force



Specifically it'll ask you to add the Homebrew version of openssl (should be 1.0.2 as of this date) into your $PATH.
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile


echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile



Note: Make sure to remove any export PATH lines from the bash_profile, since this line above exports it for you appending the rest of the $PATH variable to the end. To view the bash profile use vi ~/.bash_profile


export PATH


vi ~/.bash_profile



This fixed the problems for installing ruby gems that require compilation. (Puma in this case)



Have you tried


DISABLE_SSL=true gem install puma



Specify the version if you have version specific requirement like:


DISABLE_SSL=true gem install puma -v version_number






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)