Rails 2.0.2 App on Snow Leopard? - ruby-on-rails

I've got an app developed on Ruby 1.8.6 and frozen to use Rails 2.0.2 that hits problem after problem on Snow Leopard:
-Default Snow Leopard Ruby 1.8.7 64-bit and 32-bit running Rails 2.0.2
-rake tasks not seeing ZenTest
-openssl header mismatches while compiling 32-bit Ruby 1.8.6 from source
-image_science apparently requiring Xcode Dev Tools 10.4
-MacPorts installing 64-bit code by default (obviously)
I think I've resigned to the idea of needing Ruby 1.8.6 32-bit, but it seems to keep conflicting with underlying 64-bit system C libraries in Snow Leopard. Any tips before I throw up my hands and revert to Leopard?
Kimball

Unpack ruby-enterprise-1.8.6-20090610 somewhere and install it with:
$ ./installer --auto=~/ree186 --configure-arg 'ARCH_FLAG="-arch i386"'
Double-check your installed ruby with:
$ file ./ree186/bin/ruby
./ree186/bin/ruby: Mach-O executable i386
A problem I had while double-checking that this worked is that RVM had changed my gem home to something the installer hadn't expected. Just something to look for if you've been playing around with various methods of installing multiple versions of ruby. Outside special cases like this one, it works quite well.
As for ImageMagick, if you use macports, make sure you install it using the 'universal' variant:
$ sudo port install ImageMagick +universal
Actually, it will be significantly less pain in general if you just deal with the increased compile times and install everything universal in macports. Create a file at /opt/local/etc/macports/variants.conf containing '+universal' and any other variant flag defaults you want to set up. Open /opt/local/etc/macports/macports.conf and make sure 'universal_archs' is set to 'x86_64 i386'. After setting this up, make sure you install everything that you need via macports to avoid additional headaches.
There are also plenty of reasons to attempt an upgrade of rails to 2.3.4 if the level of complexity and test coverage are sane.

Have you tried a separate install of Ruby 1.8.6 independent of the Snow Leopard install? You can take a look at ruby_switcher.sh if you want to be able to switch back and forth easily. It's also great for testing Ruby 1.9.

Related

Complete Steps Install Ruby on Rails on Windows

Can anyone tell me complete steps install Ruby on Rails 4.2 on Windows (Windows 10)?
I don't know about Windows 10, but we have it working on Windows 7.
Here are the steps on how to do it:
Install Ruby
Install RubyGems
Download & install Rails through RubyGems
Install any third-party dependencies (ImageMagick & MYSQL2 can take some time)
Here are the specifics:
Installing Ruby is the most difficult part on Windows, mainly because you have to compile it before installing.
There are tools which have done this for you, including RubyInstaller and RailsInstaller:
If you're a total newbie, especially to compiling in Windows, you'll want to use one of the above. If you fancy the challenge, you could compile Ruby yourself with Makefile.
--
After you've got Ruby onto your system, you then need to get RubyGems. This should work pretty straightforwardly, although it may be the case that you'll have to play around with your system's settings to get it working properly.
Here is a good tutorial:
RubyGems is simply a way to connect Ruby with any of the "gem" depositories which are available. Gems are basically "plugins" / "libraries" / "dependencies" for your Ruby install, allowing you to call them in applications.
Rails is a gem.
If you therefore want to install Rails, you need to be able to get RubyGems working.
After that, you'll be able to download and install Rails, which can be done as simply as typing gem install rails in your cmd.
--
After that, you'll be able to add extra dependencies to your system, such as ImageMagick or Mysql2 to get Rails working with external resources.
This is the really tricky part on Windows, as since it's built with MinGW32, many of the core components of Ruby/Rails have to be built independently.
Ubuntu/Mac are preferred OS's for many developers simply because they support most dependencies out of the box.

Ruby 1.9.2/ Rails 3.2.2 working; what happens if I remove xCode 4.2?

I'm developing a Ruby 1.9.2 / Rails 3.2.2 app and recently I had to buy a mac and now I migrating all my work from Ubuntu to Lion 10.7.3
Yesterday I finally got Rails installed through a very painful process due to compilation errors of Ruby. This command solves my installation:
CC=/usr/bin/gcc-4.2 rvm install 1.9.2
During the various attempts, I had to install XCode 4.2 too and if I understand right, XCode is useless for ruby 1.9.2... isn't it?
So does anybody know if I can uninstall Xcode 4.2 without troubles ?
What you have now is the best set of tools for compiling rubies recomended by RVM.
Removing it will have few implications:
You will not be able to install new rubies
You will not be able to install new gems with native extesnions
If you want to remove Xcode 4.2 you will lose possibility for installing some software
nodejs
some gems like rb-fsevent
I wouldn't say that XCode is entirely useless for Ruby, just depends on what you're looking for. Syntax highlighting is decent, autocomplete w/o code hinting, and the repo tools are pretty solid. I've used it without too much complaint, but I tend to rotate through IDE / editor phases and keep a few flavors around. YMMV.
Aside from the IDE and SDKs, XCode provides gcc on OS X systems (which is why you installed it in the first place). There are other ways to accomplish this, but there's really no harm in having XCode lurking about and not using it.
I would upgrade to XCode 4.3 and install the CLI-Tools (compiler stuff etc.) than it should be save to remove XCode from your machine, since the compiler is separated and wont be uninstalled.
if you just remove XCode 4.2 (not the app itself but the developer tools) you wont be able to install some gems (gems with C extensions which need to be compiled) because it removes the compilers too.
lazy way: just keep how it is now :)
I have not done it, but you should be able to install GCC from here and get rid of xcode
https://github.com/kennethreitz/osx-gcc-installer
personally, I would leave xcode installed, unless drive space is an issue
If you want a safe option downgrade to XCode 4.1. Do not upgrade to XCode 4.3 or you will start having random crashes on some compiled gems.
The best option for ruby development on OS X Lion is XCode 4.1 and exporting CC=/usr/bin/gcc-4.2 in your .bashrc or .zshenv
This will allow you to compile ruby from 1.8.7 to 1.9.3 and all the gems you want.
As many people wrote, Xcode 4.3 seems to have issues, so better avoid this at least at this moment.
Additional note: Building Ruby 1.9.3 with Xcode 4.3, or clang compiler cause various problem. This is due to:
https://bugs.ruby-lang.org/issues/6080
This issue is resolved in development branch already.
I'm staying with Xcode 4.2.1, but I don't' recommend to set CC=gcc-4.2 in shell profiles. Instead, you can:
CC=gcc-4.2 ./configure
to configure, or
CC=gcc-4.2 rvm install 1.9.2
if you use RVM.

Would it be worth migrating a ruby install to RVM?

Several months ago, I installed ruby 1.9.1 on Mac OSX 10.6 using the instructions here, modified for the newer versions of ruby/rails/gem.
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/
A project has now come up where I need to develop a site using an older version of rails, and consequently, an older version of Ruby. I've successfully installed RVM, older versions of gem and the rails gems, but now I'm mildly worried about my environment. Technically, I have 3 groups of Ruby installs floating around - the native 1.8.7 that was included with OSX 10.6, my own 1.9.1 installed in /usr/local/, and 1.8.7 in RVM.
I'm concerned that this could cause strange, difficult to diagnose errors in the long run. Would it be worth the trouble of uninstalling my 1.9.1 /usr/local and/or the baked-in 1.8.7, and installing them in RVM?
All the Rubies you use for development should be under rvm (or rbenv, as John comments). It avoids the headaches you describe--nothing more exciting than having a surprising library pulled in.
While I have removed the system Ruby on some OS X machines and not been affected by it, the Tin Man's point about not removing it outright seems reasonable, and rvm makes it unnecessary to do so. Some tools, like brew, rely on having a Ruby available; if you do remove it, you'll need to make sure that everything the system Ruby had is still available to prevent breakage.
RVM also supports the use of its own and the system ruby interchangeably. I've made use of that before, but I also agree with Dave, in that you should probably just move into the RVM world, it won't take much more effort and gives much in return.
ryanmt#Hermes:~$ rvm use system
Now using system ruby.
ryanmt#Hermes:~$ rvm use default
Using /home/ryanmt/.rvm/gems/ruby-1.9.2-p290
I'd propose a halfway house - install the other rubies in RVM and test the apps running under those with the RVM rubies? If they work, then move completely over the RVM. If they don't, you haven't lost anything, just don't use RVM for those apps. You don't need to uninstall the originals to do this.
Don't remove Apple's Ruby, but do install RVM. You probably should remove the one in /usr/local.

Ruby & Rails installation on a Mac

I used railstutorial.org to install the latest version of ruby and the latest version of rails on my machine.
at the end of the installation I checked
ruby -v ==> 1.9.2 (great)
rails -v ==> 3.0.1 (great)
this morning I opened up terminal
ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
rails -v
Rails 1.2.6
what happened?
My advice for people who are installing ruby is to use RVM. It makes managing your ruby versions and gem versions really simple and you can install multiple ruby versions side by side.
You might want to read this post:
http://rubylearning.com/blog/2010/12/20/how-do-i-keep-multiple-ruby-projects-separate/
You can use Cinderalla to the whole ruby/rvm/mysql/redis/git/... stack set up properly. Cinderella installs everything in ~/Developer and fixes up your PATH as well. I had some issues with a corrupt git mirror last time I used Cinderalla though so YMMV.
With many unix variants, you are likely to have multiple versions of Ruby--particularly if you installed Ruby 1.9 and the system already had 1.8 installed. Essentially, the 1.8 version of Ruby has a higher precedence in your PATH than the 1.9 version. The Ruby Gems command keeps the libraries separate between 1.8 and 1.9 so that the platform will be reasonably stable.
To correct the problem, you have to find where ruby 1.9 is installed. Once you do that, you'll need to override your PATH variable. Assuming 1.9 is installed in the path: /opt/ruby-1.9.2, you will need to set your PATH like this:
PATH=/opt/ruby-1.9.2/bin:$PATH
export PATH
To make the path respect what you want every time, add that to your ~/.profile file (create it if necessary). Once the path has been set, it sould be able to find the correct version of Rails again.
I cannot say for certain because I cannot debug you OSX machine from here, however, I had a very similar occurrence. The problem was caused because I had installed ruby and then rails on my machine using sudo or from the root account. Then when I discovered rvm I installed everything in my user account. When I logged off and back in I appeared to lose everything. I was pulling out my hair. I was pissed that I was going to have to reinstall everything again... when I found the magic.
from the command line execute the command:
rvm list
you'll see that your new version of ruby is there. you'll also notice the tokens that indicate that it is just a normal version. It is not current or default. (see it yet)
Now if you run the command:
rvm use 1.9.2 --default
then every time you login/off and restart your machine your user account will default to that version of ruby and all of the gems that you installed against that version.

One-Click install for Ruby/Rails/SQLite?

I'm used to the One-Click install local environments of MAMP. Is there a Ruby equivalent... a download that you run and instantly get the most current versions of Ruby, Rails, SQLite running locally?
I'm using a Mac, running Leopard, and am aware that all of the aforementioned technologies ship with Leopard (except maybe SQLite). The books that I have reference newer versions and the last thing I need is to try to retrofit a tutorial to work with my version.
And one more less important question: What are "Gems" and is that something that I need to make sure is fully updated too?
Installation is pretty confusing when you first start with Rails! Even though a lot of what you need is already installed if you are using Mac, personally I found it really hard to find come concise information on how to best go about setting things up.
Since I didn't want anyone else to go through the headaches that I had when configuring their Mac development environment, I've written a 7 step guide to installing Ruby on Rails, MySQL, Apache with PHP, and phpMyAdmin on OSX Leopard. In short, everything you should need to get developing locally on your Mac!
Here's the link:
http://waavoo.com/2009/7-step-guide-installing-ruby-on-rails-mysql-apache-php-phpmyadmin-intel-mac-os-x-leopard/
Hope that helps!
Take a look at FiveRuns Install. It's a free Ruby on Rails stack that you can download.
RubyGems is the Ruby standard for publishing and managing third party libraries. Check out the User Guide.
Have fun!
I have no idea what mac os are you in but Leopard (10.5.x) already have ruby installed, all you need is to updated the gems using
gem update rails
in your command line.
if you're on Tiger (10.4.x) the installation is broken, and please follow this link.
You should also have a look at Phusion Passenger - this, along with the prefpane, allows you to have apache VirtualHosts set up the easy way.
Current versions of Rails are designed to work (for development) without needing an AMP -style stack, by using SQLite and a small Ruby Web server, so if you will only be doing Rails development you don't need to set up a stack - you can just type "rails" and it will work.
BUT the versions of RubyGems and Rails shipped with Leopard are now outdated, though, so you'll need to upgrade these before you go too far. There's an article that I wrote on setting up a Mac for development here, but the minimum commands go like this:
sudo gem install rubygems-update
sudo update_rubygems
sudo update_rubygems (yep, twice)
sudo gem update --system
These get RubyGems up to the current release, so that you can upgrade Rails safely. To do that, type:
gem update rails
The last command doesn't have sudo, because if you omit it, current versions of RubyGems will install a clean copy of the gems into your home directory, leaving the system versions untouched.
Finally, amend the .profile file in your home directory, so that the line with PATH in it says:
export PATH=$HOME/.gem/ruby/1.8/bin:$PATH
Close up any terminal windows for this to take effect. The utilities provided by the gem packages in your home directory will now have precedence over the system versions.
This means that you can type "rails" and the latest version will run, but you haven't messed with any of the software provided by Apple (apart from the system copy of RubyGems).
To upgrade your private copy of Rails whenever a new version comes along in future it's just this again:
gem update rails
just refer this....
http://wiki.rubyonrails.org/getting-started/installation/windows#installing_ruby_on_rails_on_windows
BitNami RubyStack is exactly what you are looking for http://bitnami.org/stack/rubystack

Resources