not able to install ruby on rails in OSX mavericks - ruby-on-rails

I have OSX mavericks and I was trying to install ruby on rails .First I tried Installing via RailsInstaller (http://railsinstaller.org/en) ,There was a notice in the website saying "Please do not run the installer on OSX Mavericks until further notice."
Then I tried installing using rvm which turned out to be a night mare .
I followed instructions from all the below links none seem to work
Installing Rails on Mavericks
Xcode install on OSX 10.9 - clang: error: no input files
Installing Rails on Mavericks
http://railsapps.github.io/installrubyonrails-mac.html
I have installed Xcode 5.0 and I have even manually downloaded Command lines tools
https://developer.apple.com/downloads/index.action
when I try
rails -v
I get a message
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
Then I tried command for which I got an error message
Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb checking for libkern/OSAtomic.h... yes creating Makefile
make "DESTDIR=" compiling atomic_reference.c atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^~~~~~~~~~~~~~~ /usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
I'm not able to use xcode-select --install either which says the software is not present in the server
Please guide on how to install rails on my osx mavericks ?

Rails 4 needs RubyGems 2.0.3. Update it and you should be good to go.
gem update --system 2.0.3
Then,
gem install rails
Hope it helps.

Related

zendesk app tools ZAT Installation errorFailed to build gem native extension

I am trying to install "ZAT" the Zendesk app tools following the documentation, but receiving this error: \
Building native extensions. This could take a while...
ERROR: Error installing zendesk_apps_tools:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220105-47488-6pwgmm.rb extconf.rb
checking for -lcrypto... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
ruby version => ruby 2.6.3p62 (2019-04-16 revision 67580)
xcode-select => xcode-select version 2384.
macOs : BIg Sur version 11.6.2
any idea what is the issue?
Installation via rvm resolves this issue.
I had the same problem on my Mac Big Sur 11.6 with M1 chip. None of the suggested solutions helps me (I tried to reinstall Xcode, updating/reinstalling command line tools, deal with the installation of thin separately, etc.). One thing that really helps me it's changing the ruby version to 2.6.9 with rbenv (https://gorails.com/setup/osx/11-big-sur - check Installing Ruby . Follow this instruction, but choose another ruby version). After change ruby version, make sure the correct version of ruby is currently selected with ruby -v and then try execute gem install zendesk_apps_tools again. I tried several versions of ruby before it worked for me, but in the end everything was fine on 2.6.9 version

Rails installation fails while running make nior4

I’m trying to install the current stable version of rails (5.2)
gem install rails
but it fails:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/ms1/.rvm/gems/ruby-2.4.1/gems/nio4r-2.1.0/ext/nio4r
[…]
compiling nio4r_ext.c
In file included from nio4r_ext.c:7:
./../libev/ev.c:488:48: warning: '/*' within block comment [-Wcomment]
/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */
^
./../libev/ev.c:1068:26: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'unsigned int' [-Wshorten-64-to-32]
[…]
fatal error: too many errors emitted, stopping now [-ferror-limit=]
9 warnings and 20 errors generated.
make: *** [nio4r_ext.o] Error 1
make failed, exit code 2
I’m on Mac OS X HighSierra (10.13.2) and I’ve installed Xcode (9.2) with developer / command-line tools (9.2), rvm 1.29.3, Homebrew 1.4.0, bundler 1.16.0, nokogiri 1.8.1.
I’m on ruby 2.4.1, but tried 2.4.2, 2.3.0, 2.2.2 as well, always with the same result.
Installing nio4r manually results in the same problem:
gem install nio4r
[…]
ERROR: Failed to build gem native extension.
Some answers on StackOverflow suggested
gem install nio4r -v '1.1.0' -- with-cflags="-std=c99"
which did not work, either.
Interestingly,
rails
gives me the following output on my machine:
Ignoring bigdecimal-1.3.2 because its extensions are not built.
Try: gem pristine bigdecimal --version 1.3.2
Rails is not currently installed on this system. To get the latest version, simply type: sudo gem install rails
Of course I tried both of the above mentioned hints, too; both result in the same problem as stated initially.
As I'm running out of ideas here and couldn't find any other helpful advice, I'm really looking forward for any ideas on this!
Filing an issue on nio4r's Github page solved my problem: There was an old port.h file from an abandoned Postgres installation in /usr/local/include/ on my system which was causing the trouble.
Removing /usr/local/include/port.h allowed me to install Rails!

Errors installing Mongrel 1.2.0_pre2 on Ruby 2.1.x installed via PPA from Brightbox

I have inherited a Ruby on Rails application codebase as part of a new gig. The code is currently live in production but I have been charged with assessing and cleaning up. As such the code includes Mongrel dependencies; specifically Mogrel 1.2.0_pre2 which might have last been updated in 2010 but that is what this code uses.
The local development environment is running in Ubuntu 12.04 and have successfully installed all Ruby GEMs via bundle install when I install Ruby 2.1.x from source code.
But I recently learned about the Ubuntu ready packages from Brightbox I was thrilled! I don’t mind installing form source but would rather deal with the cleanliness of a package install. So, on a completely clean Ubuntu 12.04 system I started to rebuild my Ruby development box I added the PPA to my repo:
sudo add-apt-repository ppa:brightbox/ruby-ng
Updated the local sources list:
sudo aptitude update
And installed their Ruby 2.1 package like so:
sudo aptitude install ruby2.1 ruby2.1-dev
And things went well until during bundle install up until Mogrel died with compilation errors:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking for main() in -lc... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling http11.c
http11.c: In function ‘http_field’:
http11.c:193:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c:194:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘request_uri’:
http11.c:235:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘fragment’:
http11.c:246:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘request_path’:
http11.c:257:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘query_string’:
http11.c:268:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘HttpParser_execute’:
http11.c:439:5: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [http11.o] Error 1
make failed, exit code 2
Gem files will remain installed in /tmp/bundler20141208-21746-1qez12a/mongrel-1.2.0.pre2/gems/mongrel-1.2.0.pre2 for inspection.
Results logged to /tmp/bundler20141208-21746-1qez12a/mongrel-1.2.0.pre2/extensions/x86_64-linux/2.1.0/mongrel-1.2.0.pre2/gem_make.out
An error occurred while installing mongrel (1.2.0.pre2), and Bundler cannot
continue.
Make sure that `gem install mongrel -v '1.2.0.pre2'` succeeds before bundling.
But running gem install mongrel -v '1.2.0.pre2' doesn’t seem to help; it goes through the expected motions and then fails with the exact same http11.c errors as when doing it via bundle install.
I have read a few threads Stack Overflow related to issues folks have had installing any version of Mongrel in Ruby 1.9.2 onwards such as in this thread and in this thread.
All of the solutions that are not focusing on “You should just use Thin instead.” talk about manually patching http11.c. But the references—like this page—are to Ruby 1.9.1 and Mongrel 1.1.5 and the line numbers referenced definitely don’t correspond to equivalents in Mogrel_1.2.0pre2.
And ironically some solutions actually direct a user to install Mogrel version 1.2.0pre2 instead of 1.1.5 to get around the issue; but I am trying to install version 1.2.0pre2 and can’t seem to get that done.
Of course I would like to know how to get past this Mongrel error, so help on that would be appreciated. But why is it that when I install Ruby 2.1.x via the Brightbox PPA this error pops up while if I compile Ruby 2.1.x directly from source this error just doesn’t appear at all?
Okay, so after some hunting around I stumbled across a solution which allows me to cleanly—without a need for manual patching—install Mogrel 1.2.0_pre2 on Ruby 2.1.x. The solution is to do a direct Ruby install of the GEM with --with-cflags like this:
sudo gem install mongrel -v 1.2.0.pre2 -- --with-cflags=\"-O2 -pipe -march=native -w\"
Once I did that compilation was completed without issue and the GEM was successfully installed:
Building native extensions with: '--with-cflags="-O2 -pipe -march=native -w"'
This could take a while...
Successfully installed mongrel-1.2.0.pre2
Parsing documentation for mongrel-1.2.0.pre2
Installing ri documentation for mongrel-1.2.0.pre2
Done installing documentation for mongrel after 1 seconds
1 gem installed
But I am still wondering why a Ruby 2.1.x install via the Brightbox PPA causes an issue when a pure source code install of Ruby 2.1.x has no problems at all.
And not 100% clear on how --with-cflags=\"-O2 -pipe -march=native -w\" factors into this, but it seems to be a common --with-cflags option used to get some stubborn (perhaps outdated?) Ruby GEMs installed on versions of Ruby higher than 1.9.2.

New Rails Project: 'bundle install' can't install rails in gemfile

I have installed a new rails project like so:
$ rails new site
and it executes and reaches:
bundle install
but then I get this error, when it appears to try installing a dependency
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
^
1 warning generated.
linking shared-object atomic_reference.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [atomic_reference.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/mikeguppy/.bundler/tmp/26234/gems/atomic-1.1.16 for inspection.
Results logged to /Users/mikeguppy/.bundler/tmp/26234/extensions/universal-darwin-13/2.0.0/atomic-1.1.16/gem_make.out
An error occurred while installing atomic (1.1.16), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.16'` succeeds before bundling.
I have then tried installing atomic independently with:
gem install atomic
and again no luck.
I'm running Ruby 2.0 on Mac OS 10.9.2
Any help would be much appreciated!
this worked for me:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install rails
I had this same problem and what worked for me was installing RVM, installing Ruby 2.1.1 (an upgrade from the 2.0 that comes packaged in Mavericks)...
rvm get stable
rvm reinstall 2.1.1
(use whatever the latest version is, for me that's 2.1.1)
...and then run rvm use 2.1.1 to make sure that I had switched to using that version.
After that, my gem installs ran smoothly.
This appears to be an issue relating to the system Ruby that is packaged with Mavericks (2.0.0p247), see details about the bug here: https://bugs.ruby-lang.org/issues/9624
I got around this by installing rbenv (or RVM if you prefer) and then installing Ruby 2.1.1 so as not to tamper with the system Ruby version. You will still get a warning during the installation of the atomic gem but it won't fail at least.
rbenv here: https://github.com/sstephenson/rbenv
I had the same problem when installed rails.
My ruby version is 1.9.3 p448 and OS is OS X Mavericks (10.9.2).
Here's what I tried and it works.
$ gem install rails --version 4.0.4
[ref]
http://ruby.railstutorial.org/chapters/beginning#top
First uninstall any existing atomic gem
gem uninstall atomic
Then reinstall it using
gem install atomic -v '1.1.16'
After this try to create a new rails application
rails new projectname
I don't know which version of Rails you are currently using. Sometimes, re-installing Rails to a stable version seems to help. You may want to try that as well if the above steps didn't resolve the issue.
I had a similar problem recently and it was because Xcode updated automatically to 5.1. This version contains a bug/problem with gcc.
The clue is here:
-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning)
Sadly I had to downgrade Xcode - available here.
Ruby 2.1.5 on Maverick via rvm installed atomic 1.1.16 without issue.
This error can occur if you are bundling with the wrong version of ruby for the bundle. Check the Gemfile for the ruby version and then check the output of ruby -v. If there is a version mismatch, use rvm to make sure you are using the same version of ruby, then re-bundle.
I got this exact error and fixed it by changing the version of ruby I was using.
None of these worked for me. I came up with my own solution. The problem lies in json versions less than 2.0. When I tried to upgrade json, I got an error message about dependency issues with rails and sdoc. Here's what I ended up doing:
Open your Gemfile.
Comment out the lines for sdoc and rails.
Add this line:
gem 'json', '> 2'
Run bundle install.
Worked for me.

Cannot install Puma gem on Ruby on Rails

I'm trying to install the puma gem, but when I run
gem install puma
I get this error message:
Temporarily enhancing PATH to include DevKit
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
generating puma_http11-i386-mingw32.def
compiling http11_parser.c
ext/http11/http11_parser.rl: In function 'puma_parser_execute':
ext/http11/http11_parser.rl:111:3: warning: comparison between signed and unsigned integer expressions
compiling io_buffer.c
io_buffer.c: In function 'buf_to_str':
io_buffer.c:119:3: warning: pointer targets in passing argument 1 of 'rb_str_new' differ in signedness
c:/Ruby193/include/ruby-1.9.1/ruby/intern.h:653:7: note: expected 'const char *' but argument is of type 'uint8_t *'
compiling mini_ssl.c
In file included from mini_ssl.c:3:0:
c:/Ruby193/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
mini_ssl.c:4:25: fatal error: openssl/bio.h: No such file or directory
compilation terminated.
make: *** [mini_ssl.o] Error 1
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0/ext/puma_http11/gem_make.out
Adding gem 'puma' to my Gemfile and running bundle install isn't an option, because that just doesn't work with any gem and gives me an error message (which is a separate issue, one that I've circumvented with the other gems I've used by installing them via gem install).
Came across very same issue.
sudo apt-get install libssl-dev
fixed it for me.
I ran bundle update before bundle install and that solved the issue for me.
I'm not sure if that was the only thing that helped, as I manually updated puma before that, using these steps:
Checked which version of openssl Ruby is using by running ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
Downloaded the right openssl version from
http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma
(got the link from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows and edited it based on the output of #1).
Extracted openssl using http://www.7-zip.org to C:\RailsInstaller\openssl
gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl
Figured out the solution to the puma bundle. Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
First you need to download:
DevKit compatible with your ruby version
OpenSSL Developer Package (contains header files and binaries)
And then:
Install DevKit, e.g. in c:\devkit
Unpack the OpenSSL Package, e.g. in c:\openssl (use 7Zip or PeaZip)
You need to copy the ddls from the bin directory (libeay32.dll and ssleay32.dll) to your ruby/bin directory.
Open a windows console
Initialize the DevKit build environment: c:\devkit\devkitvars.bat (except here, I used this in command prompt instead: ruby dk.rb init)
Now it’s possible to install the puma gem with the OpenSSL packages:
gem install puma -- --with-opt-dir=c:\openssl
I think you hit issue #430
https://github.com/puma/puma/issues/430
Re-installing Ruby might help you as well as it closed this issue on GitHub.

Resources