sqlite3 gem on Mac OS X Lion... fail! - ruby

I just upgraded my Mac to Lion but unfortunately I had to re-setup my Rails development environment. With the following versions of software:
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
Rails 3.0.9
sqlite3 3.7.5
When I run the command:
sudo gem install sqlite3
It throws following exception:
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb
can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
And the it adds:
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
Did anyone dive into Lion yet..
Thanks

I was having problems with this. I downloaded the Xcode from Apps store and it still didn't work. I reinstalled Xcode 3.2 and still nothing. Then I read a post that said that downloading Xcode and installing it were different. I went the Applications and ran the Xcode installer and after that everything worked fine.

I had this problem too and realised installing XCode is not enough, following installation you need to go into XCode -> Preferences -> Download, and install the Command Line Tools. This installs GCC.

I've always had problems with OS X's built in Ruby. Use RVM. Helps Ruby devs manage their Ruby versions and libraries. Definitely recommended. Then from there, install your gems.
Install Guide: http://beginrescueend.com/rvm/install/
Edit: You won't even need to sudo anymore since everything is in your home directory hidden.

Installing Xcode didn't do the trick for me. Instead, I installed Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
Then installed sqlite with Homebrew:
brew install sqlite
And then finally ran:
sudo bundle install
within my Rails app, which successfully installed Sqlite

updated Xcode for Mac OS X Lion and sqlite3 gem installed without any trouble... So I think whenever anyone upgrades their Mac OS, the first thing they should do is update Xcode after the upgrade...

If upgrading to Lion, the first thing I would recommend is downloading and INSTALLING the new Xcode (4.2) from the Apple website. I know this is in regards to rails, but I like having Xcode for messing with Iphone and Ipad applications (granted I'm not very good at it...yet).
Then, you will want to download the GCC installer:
github.com/kennethreitz/osx-gcc-installer/downloads. Download the latest one.
This is somewhat of a replacement for Xcode and it will tell you that you can uninstall Xcode after this install is finished. That's up to you: I did not uninstall Xcode afterwards.
To test it out if it made an impact, I created a rails new appname in my terminal. The bundle worked fine, before it did not. There was an issue with gem install json -v '1.6.5'
Fwiw I'm currently in Chapter 9 of the Hartl tutorial and was working in rails 3.1, Snow Leopard OS X Before today.
Hope this helps!

I just upgraded to Maverick and had trouble with a few gems.
Go to Apple Developer Downloads and pickup Command Line Tools (OSX Mavericks) for Xcode.
After installation, I was able to bundle sqlite3 and pg gems.

For those still having issues installing sqlite3 gem in Mavericks:
sudo xcode-select --reset
xcode-select manual says, the reset option
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism.
By the way, this happened to me while migrating from Snow Leopard to Mavericks. I think the issue was with the developers tool path, which is different in each of these operating systems.

Related

Failed to Install CocoaPods in Unity LTS 2017.4.40f1 and Appodeal on mac os x Mojave 10.14.5

I am using Appodeals ads integration on Unity LTS 2017.4.40f1 on mac os x Mojave 10.14.5.
The integration fails with an error in the Unity iOS Resolver window:
Installing CocoaPods...
gem install cocoapods --user-install
WARNING: You don't have /Users/developer/.gem/ruby/2.3.0/bin in your PATH.
gem executables will not run
ERROR: Error installing cocoapods:
zeitwerk requires Ruby version >= 2.5
Also in the unity console I get this error: "Failed to Install CocoaPods for the current user."
I have tried many things and all failed.
I have tried updating my ruby with brew but Unity does not recognize it.
When I type in terminal: ruby -v
I get: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin18]
Unity still can't see the new Ruby
I tried to install cocoapods manually many times, it worked well but it's still not recognizable by Unity/Appodeal.
I tried to go with a terminal to the Unity project directory and install cocoapods with --user-install switch, and still nothing changed
I tried adding Ruby paths to $PATH, but nothing changes.
I tried multiple Ruby versions, including 2.3.0, 2.5.0 and 2.7.0
I restarted the system and Unity many times, and also tried reimporting the plugin
Tried multiple solutions from web, but nothing works.
My question is: how to resolve this problem so Appodeal works on my Unity 2017?
Extra question: why seemingly nothing works, why even with cocoapods installed Unity Appodeal still complains?
There is a flag that needs to be added --with-libyaml-dir=$(brew --prefix libyaml) --with-openssl-dir=$(brew --prefix openssl. Homebrew runs in the system context and so can't update ~/Library.
Steps are on this markdown: https://gist.github.com/RedenticDev/2c71869492ba2740a3725216898c522a
I had the same issue, though with different software versions. Unity 2020.3 on Big Sur (Mac OS 11).
Your other easier option might be to upgrade your Mac OS and then the version of Ruby will also be implicitly upgraded as well.

Why am I having trouble compiling Ruby 1.9.2 with RVM on Mac OS Lion?

I am having trouble installing Ruby 1.9.2 with rvm on Mac OS Lion.
It gets stuck in the compilation stage; I don't see any errors or output, but it will be stuck at the compilation message for hours upon hours. The miniruby process is still running and using quite a bit of CPU, but it just never finishes.
The only thing I can find in the logs is this message in the make.log:
<internal:prelude>:1: [BUG] Segmentation fault
Any ideas how I can get this to compile?
What version of xcode are you using?
rvm requirements has this little tidbit:
** Lion Users: Xcode Version 4.2.x for OS X Lion works only for ruby 1.9.3-p0 (or higher).
It currently fails to build several other rubies and gems, as well as several Homebrew and
Macports packages. Xcode Version 4.1 (4B110) works.
Xcode v4.1 is at: https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_4.1_for_lion/xcode_4.1_for_lion.dmg
It's also important to make sure your RVM is current. Run rvm get head to upgrade to the latest version.
It may be related to Lion trying to use llvm to compile instead of gcc. Try running the command like this CC=/usr/bin/gcc-4.2 rvm install 1.9.2 to use gcc.
Based on the information in this other answer: Why can't I install Rails on Lion using RVM?
First read the installation notes of rvm, Follow the link which helped me RVM on Mac

Having Trouble Installing Ruby with RVM

I'm trying to install Ruby-1.9.2-head on a Mac running OS X 10.6.8 and Xcode 3.2.5. Whenever I run the command "rvm install ruby-1.9.2-head", I get an error during the "#configuring" part. The configure.log file says:
./configure --prefix=/Users/me/.rvm/rubies/ruby-1.9.2-head --enable-shared --disable-install-doc --with-libyaml-dir=/Users/me/.rvm/usr
configure: error: cannot run /bin/sh tool/config.sub
I've tried completely removing rvm and then re-installing the stable version (1.10.0) according to the instructions on Wayne's RVM homepage to no avail. Also, I do already have the 1.8.7 version of Ruby (which came with the machine) still installed.
I was successful in installing rvm and Ruby on two other machines that are also running OS X 10.6.8 but they were running Xcode 3.2.6. Do I perhaps need to upgrade Xcode?
Thanks.
rvm notessays you just need Xcode Tools Version 3.2.1 (1613) or later to install rvm.
I can remember I had to install the latest XCode version since my Lion upgrade to install ruby 1.9.2. Although you running OS X 10.6.8 and not Lion, there should be a new XCode version for you to download.

Cannot install rmagick gem in Lion: gems can't find ruby.h

I've got a clean instal of Mac OS X Lion, and I've installed the Developer Tools. I'm trying to install some ruby gems and the ones which need native extensions aren't building.
sudo gem install rmagick
For example will not build. I get back this error:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
It looks like the ruby.h header file has moved in Lion, but I don't know how to point ruby gems to it.
I've also updated rubygems itself with
sudo gem update --system
But the issue persists. Ideas?
First, if you're still using sudo gem, you should probably switch to RVM, which manages lots of rubies and gemsets, all in your home directory so there's no permission problems, and cleanly switches between them.
RVM: http://rvm.beginrescueend.com
Second, even though you say you "installed the Developer Tools" you may not have gotten XCode and all the libraries. These days XCode for Lion is available on the Mac App Store -- for free, thankfully, though it was $4.99 for a few months, and annoyingly, the Leopard and Snow Leopard compatible versions of XCode are not on the Mac App Store.
XCode: http://itunes.apple.com/us/app/xcode/id448457090?mt=12
Third, rmagick depends on ImageMagick. The easiest way to get that these days is via HomeBrew (MacPorts had its day, but everybody's brewing now).
HomeBrew: Link
After all that, the following should work (and just now worked for me on my Lion laptop):
brew install imagemagick
gem install rmagick

gem install LibXML-Ruby Native extension fails to build under RVM 1.9.2

I am trying to gem install libxml-ruby under RVM's 1.9.2-p0 on a Snow Leopard installation. The build process of the native extension, however, halts with this error:
~/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/mkmf.rb:368:in 'try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
I'm not sure where exactly to start in terms of debugging this issues, but if anyone has a hint at a solution, I would much appreciate it. Here is a full dump of the log: https://gist.github.com/3b13bf6f66f5bd6033ca.
The message:
You have to install development tools first.
means you don't have Apple's XCode development environment installed. You can download it from Apple's XCode site with a free registration.
The XCode environment is also included with the Snow Leopard DVD, but it was buggy, so download the latest version.
Your question isn't exactly clear though. RVM isn't anywhere near a 1.9.2 release, so I think you mean "Ruby 1.9.2-p0". If so, then I'm not sure how you got Ruby installed under RVM's control without the development environment unless... did you run sudo or su to root before trying to install LibXML? If so, that is potentially the problem as you're never supposed to install gems under RVMs control using sudo if you're running a single-user version of RVM.
If you're sure all your existing RVM and Ruby and XCode are good, try rvm package install libxml2.
Also, as a safety tip, remember to periodically run rvm get head to make sure its current. I run it every other day, but weekly or monthly should be good.

Resources