Installing Ruby on Rails Application with Ruby Enterprise Edition 1.8.7 - ruby-on-rails

I want to install one Application on my CentOS 5.5 which requires Ruby Enterprise Edition 1.8.7 and Rails 2.3.5.
I have installed REE from rubyenterpriseedition.com. To install my application I need to do some settings.
In my .bash_profile I should change PATH = $PATH:$HOME/bin to
PATH=/opt/ruby-enterprise-1.8.7-2012.02/bin:$PATH:$HOME/bin
then to reload
source .bash_profile
To check whether changes have been reflected, we must run which gem. This has to output output:
/opt/ruby-enterprise-1.8.7-2012.02/bin/gem
But Unfortunately it is outputting
[root#local ~]# which gem
/usr/bin/which: no gem in (/opt/ruby-enterprise-1.8.7-2012.02/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/college/bin:/root/bin)
After that when i do
[root#local ~]# gem update --system
bash: gem: command not found
I am getting above error.
But Look at the Actual PATH Below...
[root#local college]# echo $PATH
/usr/kerberos/sbin:/opt/ruby-enterprise-1.8.7-2012.02/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/college/bin:/root/bin:/opt/ruby-enterprise-1.8.7-2012.02/bin
Please help me out to install this application on my CentOS.

I think you are mixing up versions. I see both 2011.03 and 2012.02 mentioned. Please check which version you actually installed and make sure your PATH variable has this version as well.

Related

Two different ruby versions on mac?

I am setting up a simple ruby on rails app locally. It seems I have two different versions of ruby on mac and I would like to only use one. When I ran bundle install, it says Your Ruby version is 2.7.1, but your Gemfile specified 2.6.3. Then, I changed the line ruby '2.6.3' in my gemfile to ruby '2.7.1'. With this it ran bundle install properly. However, when I run rails server it says Your Ruby version is 2.6.3, but your Gemfile specified 2.7.1.
Why is it saying two different values for my Ruby version?
How do I get it to only use one version of Ruby?
If its relevant, I am on a mac and installed ruby using homebrew. If I run ruby -v in the terminal it says ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]. I'm not sure why it says I have ruby 2.6.3.
There are to different versions because Mac OSX already includes one by default for system scripts (2.6). Homebrew install another one that never overrides o reemplace the System Wide version.
You are looking for a "Ruby Version Manager", are tools that allow you to install and use different versions of Ruby, even per project.
The popular ones are RVM and rbenv. Personally, i choose rbenv and I think that is the most widely used of both. Example of use:
# Install ruby 2.7
rbenv install 2.7.1
# Make ruby 2.7 the default version
$ rbenv global 2.7.1
# Or make 2.7 the default versiĆ³n only on a specific project
$ cd myproject
$ rbenv local 2.7.1
# this create a ".ruby-version" file
This webpage always have the most recent and easy to use tutorial for setup a Ruby environment, depending on the OS and version.
https://gorails.com/setup/osx/10.15-catalina#overview
You have two different versions of Ruby installed, because MacOS natively comes with a standard installation of Ruby.
You also have rails pointing to the system version of Ruby. That version is usually under /usr/bin/ruby. The Homebrew installed version of Ruby (which is what you want) is located under /usr/local/bin/ruby unless you specified a completely different root path to install your brew packages.
Running brew config will give you a short list of data about your Homebrew configuration. Among them is an environment variable called HOMEBREW_PREFIX, which should look something like this:
$ brew config
....
HOMEBREW_PREFIX: /usr/local
....
I recommend placing /usr/local/bin first on your PATH environment variable so that you can easily use your brew packages via the CLI:
export PATH="/usr/local/bin:$PATH"
You may also want to look into setting the following environment variables for whichever shell you are using (examples given):
RUBY_ENGINE=ruby
RUBY_VERSION=2.7.1
GEM_ROOT=/usr/local/etc/ruby-2.7.1/lib/ruby/gems/2.7.1 (alias for GEM_HOME)
gem env gives a lot of great information on how Gems is configured.
I I had this exact problem and managed to fix it by running this command:
CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.6.7
Note - I needed that version (2.6.7) please change it to the one you need
I found this on this blog post here - https://dev.to/rbazinet/fix-installation-of-ruby-using-rbenv-on-macos-big-sur-3432

How to solve a RubyMine "'ruby-debug-ide' isn't installed" error

I get the error:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
but all gems were successfuly installed:
gem 'ruby-debug-ide'
gem 'debase'
I can run 'rdebug-ide' manually:
$ rdebug-ide
Using ruby-debug-base 0.2.1
Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine, or
the IntelliJ IDEA Ruby plugin. The command line interface to
ruby-debug is rdebug.
But when I start debugging, RubyMine asks to install the ruby-debug-ide gem. Why?
And, after installation I get:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
I'm running Mac OS X 10.11.3.
Here's the actual command that worked for me:
gem install ruby-debug-ide --pre
Complementing Ahsan Ellahi
In your terminal you're probably not running the same ruby version as inside Ruby Mine. You can check this
In Ruby Mine
Preferences --> Laguanges and Frameworks --> Ruby SDK and Gems
In Terminal
$ ruby -v
If you're not running the same version, try to set RubyMine to use the same Ruby version that you're running in your terminal. This should solve the problem. Than, if you really want to use another RubyVersion, you will need to go to your terminal, change the Ruby version and manually install both gems
I have faced this issue when debugging in a docker-compose environment. I suspect that RubyMine does not refresh the list of available gem after the SDK is added.
So if you add the SDK then add ruby-debug-ide to Gemfile you will get the error.
Instead, (re)create the SDK after adding ruby-debug-ide.
I started getting this after upgrading from 2017.x to 2018.1. In my case, it seems that RubyMine needed a newer version but its error message implied it couldn't find any version and failed to install it. I think it was trying to install it with a different SDK.
Manually installing the latest ruby-debugger-ide (in my case the --pre flag was necessary) and then restarting RubyMine did the trick for me.
Since you're using Mac OSX, I couldn't provide the same exact answer for you, but you can find a similar way of achieving this. I'm using Ubuntu with Vagrant, so you may need to adapt it just a little bit.
Copy the following gem from RubyMine/rb/gems app folder, please copy the gem related to your ruby runtime and platform, there are different gems for different ruby runtime and platforms, in my case, its:
debase-0.3.0.beta7.gem
ruby-debug-ide-0.8.0.beta6.gem
Install them inside your app host, in my case its vagrant, in your case it could be inside your container, or in your host OS using the following command:
gem install --force --local *.gem
Set breakpoint and start debugging.
It may asks you one more time to install the gem, but then the debug will works for sure.
This worked for me
gem install debase-ruby_core_source
Source: Cannot install Rubymine Debugger
You should look into RubyMine settings, which ruby version and which gemset (global/default) it is using. Check out where these required gems are installed and make sure RubyMine is using that gemset where these are installed successfully.
I fixed this after viewing the responses here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206072049-Cannot-start-debugger
The solution at the bottom suggested 'removing all my gems. removing ruby. cleaning up directories and rvm. removing ruby mine, then reinstalling everything'
I started with the easiest of these, which was to reinstall rubymine. That solved it for me.
I had this issue on Windows 11 running Ubuntu on WSL2. To solve, I manually copied the relevant files in my %AppData% directory into the corresponding directory in Ubuntu.
I found all the data at:
C:\Users[USER]\AppData\Local\JetBrains\RubyMine[VERSION]\ruby_stubs\[NUMBER]\home\[USER]\.gem\ruby\2.7.0
These files were copied to: \\wsl.localhost\Ubuntu\home\[USER]\.gem\ruby\2.7.0
After doing this, everything worked again.
I have faced this issue too with Rubymine 8, rvm 1.29.1 and Ruby version 2.3.3 And upgrading the Rubymine version from Rubymine 8 to Rubymine 2016.3 or latest resolves the issue for me.
Check ruby SDK's version is right.You can first using rails installer to install everything .
Then using gem to install rdebug for ruby 2+.
Make sure Rubymine's Ruby version is same to which you have installed.With those all done,you will be able to debug ruby.
Please check x286 vs 64 version, both Ruby and Rmine version. I had this problem runnin x86 rubyMine on 64 ruby
A combination of matching the host ide ruby version with the remote SDK version worked for me but required a few additional steps. I too am running mac os as my host (running mohave)
the remote environment setup in preferences -> ruby sdk and gems must have the same version as the remote target, including any gems installed.
NOTE: I had to re-install the bundler gem on both host and remote host to get the gem manager to install things auto-majically.
the project environment must be changed to use the same version as the remote host as well. this is in File -> preferences for new projects -> ruby sdk and gems.
NOTE: I also had to set the default RVM on my local host and remote host and unset the previous version as default in the local host preferences.
Once I did this I was able to get gems in sync and remote debugger to connect.
My solution was to go to Rubymine settings, to the available SDKs,
remove the SDK, restart Rubymine and add the SDK again.
Running Ubuntu 18 something, RubyMine version 2020.3. Had this issue. None of these suggestions worked for me, same error no matter what did. I was using RVM, and ruby 2.6 and 2.7, switched back and forth a cleaning and reinstalling gems along thew way, both debase and ruby-debug-ide were installed according to the gem list. Settings in rubymine matched "ruby -v" from the command line. VSCode worked perfectly with this setup.
In the end i removed RVM and all the ruby versions, installed ruby via rbenv, installed ruby 2.6.5 and that worked like a charm.
I think this error is generated for multiple reasons with no real way to figure out which reason for your specific instance. I would like to encourage jetbrains to generate more debug information on errors like this, or if you are generating error information, point out where it is when this happens.
Try these steps:
1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. brew install ruby
3. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
if you get unshallow error on any step then first try:
1. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
2. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
3. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4. brew install ruby
5. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
Lastly restart the terminal and check .bash_profile:
- nano ~/.bash_profile
If you see the path variable, just close it. Otherwise it means something went wrong :/.
The last step is to open
RubyMine -> Preferences -> Language and Frameworks -> Ruby SDK and Gems -> select the newest ruby version and apply.
You may need to update ruby version from the gemfile.
And it should be done!

Ruby on ubuntu 12.04

Yesterday I installed ruby and rails using rvm in ubuntu 12.04 and it is working fine and also created a sample application.But today when i run
ruby -v
it is showing like
The program 'ruby' can be found in the following packages:
ruby1.8
ruby1.9.1
Try: apt-get install
You probably forgot the latest step when installing RVM. It is mentioned at the end of the install process but easily overlooked. It boils down to this:
Make sure you have the following lines at the bottom of ~/.bashrc:
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
source "$HOME/.rvm/scripts/rvm"
This will load RVM right after you open a new shell. Without it, RVM is not 'activated' and when you type ruby it will use the version installed through your OS package manager and not the version installed through RVM.
Run rvm list. If it shows rubies then everything is ok and go to step 2.(if any problems then try reinstall rvm)(if it shows empty rubies list, then install ruby using rvm again(rvm install 2.1.1)
Specify current rvm ruby by one of the following ways:
Specify ruby version manually by running rvm use 2.1.1 for ruby2.1.1. This way you have to call this command every time you open a terminal (see next ways if this doesn't suit you)
Set default ruby version. See here.
Use .rvmrc file in any directory(see here how) to make rvm change ruby version when you open this directory.
Probably that is your case.
In addition to zwipple's answer, if you can also load rvm for once using following command:
source ~/.rvm/scripts/rvm
ruby -v
=> #your ruby version

Rails - Closed terminal and rebooted machine - now bash tells me rails isn't installed

Running OSX Mavericks, ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0], rvm 1.25.23 (master), and rails-4.1.0 (allegedly)
I'm working through the railsapps.org book on learning rails and made it about 1/2 way through yesterday. When I stopped for the day, I closed out iTerm2 and shut off the Macbook Pro. Today, I powered up, opened iTerm, navigated to my working directory (~/rubyonrails/learn-ruby) and entered rails -v.
I see this:
`Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.`
So I run sudo gem install rails and it shows that it has installed rails-4.1.0. Now rails -v still gives me the same error message above.
I tried also running rvm use ruby-2.1.1#learn-rails first and I still get the error message.
So I'm a little stuck and I can't figure out what to do to get rails working. Also, how do I go about setting up the bash environment such that I don't have to go through this each time? It would be nice to nav to my working directory and just start work without having to do a bunch of re-installation and reconfiguration each time.
Regards,
Jeff
please type in your shell:
$ bash --login
and then repeat your commands.
rails -v
Also try to call it with the full path:
like:
/your/path/to/rails -v
I think that the shell just doesn't know where rvm/rails etc is located.
You can solve this by entering:
$ source ~/.rvm/scripts/rvm
When you switch to the ruby-2.1.1#learn-rails ruby/gemset combo, and do gem list, what do you see?
The way people usually use rvm is to have every project folder specify the ruby & gemset it uses (they don't all have to be different). This is done with files called .ruby-version and .ruby-gemset. These should contain, in your case, ruby-2.1.1 and learn-rails respectively.
Set these if you haven't already, then leave the folder and enter it again. Then do bundle install to install the gems for the project into the rvm/gemset combo.
Your problem is that you ran
sudo gem install rails
The error message telling you to do this comes from your system Ruby, which doesn't know that you want to use RVM.
RVM installs gems into your user-space directory. By using sudo, you're bypassing this and installing it into (effectively) the superuser space, i.e. globally.
If you instead just run
gem install rails
then you'll be using RVM's copy of the gem utility rather than the globally installed version.

How to run or setup rails3?

Have 2 ruby installations 1.8 and 1.9.1, have 2 gems. From "gem1.9.1 install rails" installed rails3 to my system, but don't have "rails" in my "path".
How can i get rails to launch from entering rails in terminal?
EDIT
removed all ruby and ruby-gems from my system (Ubuntu 10.10) and installed ruby1.9.1 - it came with gems1.9.1 and then installed
gem1.9.1 install rails
How do i make "rails" run the installed gem rails?
EDIT 2
Found it!
The rails was installed in /var/lib/gems/1.9.1/bin/rails
just had to add a alias "rails" to it in system $PATH
How did you install your rubies? I'd strongly suggest to use a version manager like rvm, otherwise you're asking for trouble.
You should be specific about your system environment. In windows when you install ruby, you just have RUBY_HOME/bin in your path. Whenever you install rails by gem install rails , it automatically deploy executable files in RUBY_HOME/bin folder. So that you can directly execute that command.

Resources