Readline errors prevent me running rails console - ruby-on-rails

My environment is rails 3.1, ruby 1.9.2, rvm, Xubuntu 11.10.
When I try to run the rails console within an app, I am getting require errors pointing at readline.
So I am trying to install readline as a package within RVM, but this is the error I am getting:
Applying patch '/home/rob/.rvm/patches/readline-6.2/patch-shobj-conf.diff'...
ERROR: Error running 'patch -p0 -f < /home/rob/.rvm/patches/readline-6.2/patch-shobj- conf.diff', please read /home/rob/.rvm/log/readline/patch.log
ERROR: Patch /home/rob/.rvm/patches/readline-6.2/patch-shobj-conf.diff did not apply cleanly... back to the patching board :(
The log contains
[2011-10-26 10:16:30] patch -p0 -f < /home/rob/.rvm/patches/readline-6.2/patch-shobj-conf.diff
patching file support/shobj-conf
Hunk #1 FAILED at 157.
1 out of 2 hunks FAILED -- saving rejects to file support/shobj-conf.rej
I've tried
$ rvm pkg install readline
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
And
$ cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
$ ruby extconf.rb
$ make install
The latter gives me
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
Running 'rails server' works, so I think the problem is just with readline.
Can anyone point me in the right direction.

Ran into the same problem on Ubuntu 10.0.4 and managed to fix it with:
rvm uninstall 1.9.2
sudo apt-get install libreadline-dev
rvm install 1.9.2 --with-readline-dir=/usr/include/readline

I've reinstall ruby 1.9.2 pointing at my system version of readline using this command:
rvm install 1.9.2 --with-readline-dir=/usr/include/readline
That seems to have fixed my problem and everything is now working.
Rob
Also worth noting that a matching issue exists on the rvm github site and it should be fixed soon:
https://github.com/wayneeseguin/rvm/issues/515

Ubuntu 11.10.
For me the following worked:
First install rvm.
Then install everything from rvm requirements
Then install 1.9.3 or whatever.

Related

Can't install rails - "File exists # dir_s_mkdir" error

I have had rails installed and almost working. Was working on a solution to another problem with I accidentally closed the bash window. So I reopened it, and now I am unable to use rails at all and it's telling me that rails isn't installed. So I ran gem install rails --no-ri --no-rdocand now I get the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists # dir_s_mkdir - /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems`
How do I correct this error?
I just removed the broken gems, site_ruby and vendor_ruby symlinks from the /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/ folder and now everything seems to work fine.
I just added a gems/ directory here /usr/local/lib/ruby/ and that solved the issue.
for a temporary solution, you can mkdir -p /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems/2.1.0 to solve.
When you open your bash window (called the "terminal window" or "console"), what folder ("directory") are you in? Find out with:
$ pwd
Navigate to the folder where you created your Rails project using the Unix cd command, for example:
$ cd workspace/learn-rails
If you are using RVM, make sure you have selected the correct gemset:
$ rvm gemset list
gemsets for ruby-2.1.1 (found in ...)
(default)
global
=> learn-rails
Then see if Ruby and Rails are installed:
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0
Refer to the article Install Ruby on Rails for help. If you haven't followed all the steps in the article, you may have problems, especially if you followed some of the inaccurate instructions found elsewhere on the web.
I was recently in this wormhole. It seems like Homebrew's ruby installation has an issue with soft links and uses version 2.1.1. I couldn't "gem install" anything without getting the annoying "File exists # dir_s_mkdir" error. Even tried MacPort and that was a nightmare.
First uninstall ruby via
brew uninstall ruby
or
port uninstall ruby
And follow the instruction on https://rvm.io/rvm/install to install ruby
\curl -sSL https://get.rvm.io | bash -s stable --ruby
It might then complain about ruby-2.0.0-p353 not installed
To install do:
rvm install ruby-2.0.0-p353
Then run the rvm install script. Your "gem install << whatever >>" should now work
This fixed the issue for me (Homebrew on a Mac, Ruby 2.1.3):
$ brew reinstall ruby
$ brew unlink ruby && brew link ruby
the same issue. I just remove dir_s_mkdir, then pod install. it works for me!

How to compile Ruby with Readline support?

I'm running Linux Mint 15 which is based on Ubuntu 13.10. I installed Ruby with RVM. I'm trying to run Rails and I get the following error:
You're running a version of ruby with no Readline support
Please `gem install rb-readline` or recompile ruby --with-readline.
I tried every suggestion I found here on SO regarding this problem but I still get this error when trying to run rails server. The suggested website for the fix http://beginrescueend.com/packages/readline/ is unavailable.
For macOS: https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X
RUBY_CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 2.3.1
This was answered here for ubuntu/rvm combination: How to get Readline support in IRB using RVM on Ubuntu 11.10
I use chruby/ruby-build for the task, with ruby-build it can be done just like that(you can install it even to rvm folder):
export RUBY_CONFIGURE_OPTS=--with-readline-dir=/your/readline/headers/path
ruby-build 2.0.0 ~/.rvm/rubies/

Why do I get a requirements error when trying to install Ruby with RVM?

I would like to install Ruby 2.0 with RVM on my Ubuntu system and get an error message:
rvm 1.23.5 (master)
ubuntu 12.04 (LTS)
**---- Error message: -------**
rvm install 2.0.0
Searching for binary rubies, this might take some time.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system.....................................................................................................................................
Error running 'requirements_debian_update_system ruby-2.0.0-p247',
please read /home/emzett/.rvm/log/1381812161_ruby-2.0.0-p247/update_system.log
Requirements installation failed with status: 100.
Update the system using:
sudo apt-get update
Try:
rvm remove 2.0.0 # uninstall rvm
rvm get head --autolibs=3 # get the latest RVM and build required libs
rvm requirements # check if there are any dependencies that need to be installed.
rvm install ruby-2.0.0
I solved the problem by editing
etc/apt/source.list.d/medibuntu.list
I just commented the line referring to medibuntu out.
https://gist.github.com/pcjpcj2/5443017
I recommend this gist.
if you need Ruby on Rails 4.0 ~ , best answer is here
I had the same issue. I ran the following command to fix it:
sudo apt-get -f install
Then I remembered that I failed installing a package earlier that day. What this command did was resolve the dependencies on that package and allowed RVM to do its thing.
This happens when there are broken sources in /etc/apt/sources.list.d or /etc/apt/sources.list.d
You can run Ubuntu Software update to see if there are any any failures due to broken sources, if so, follow the below steps
fix them or comment and execute the following steps
rvm requirements -- this will install all of
the required software modules
rvm list -- provides you the available versions of ruby
rvm install ruby-x.x.x -- This will install x.x.x version of ruby, please change the ruby-x.x.x with the version you are interested in ex (ruby-2.1.0 for 2.1.0 version of ruby)

executable ruby1.8 missing

So I was trying to install redmine on an apache2 server on Ubuntu.
Between multiple atemps to install a plugin, I "accidentaly" deleted /usr/bin/ruby1.8.
Now I get this error when I try to launch redmine with ruby2.0 (even after a rvm install 1.8) :
*** ERROR ***: Cannot execute /usr/bin/ruby1.8: No such file or directory (2)
What should I do to have this executable back ?
Thanks for your help
I suspect ruby1.8 was the already installed system ruby; can check with dpkg --get-selections | grep ruby . If this is the case, I would uninstall ruby 1.8 from rvm and then reinstall the system ruby through apt.
Once that's been cleared up, and you have a /usr/bin/ruby1.8 again, check/manage your available rubies through rvm:
rvm list
rvm use <ruby version>
etc.

cannot load such file -- openssl (LoadError)

In OS X in rvm how do I check if openssl is configured properly?
I get the cannot load such file -- openssl (LoadError)
And I have tried everything in Rails 3 - no such file to load -- openssl with no success.
Check what rubies are installed:
rvm list
Then make sure to use one of the installed rubies:
rvm use 1.9.3-p327
And test if openssl is available:
ruby -ropenssl -e "puts :OK"
It will print OK if openssl is enabled, otherwise you will get exception
In case of exception =>
UPDATE:
new version of rvm has improved automation support:
rvm get stable
rvm autolibs enable
rvm reinstall all --force
OLD:
run:
rvm requirements run force
rvm pkg remove
Followed by:
rvm reinstall all --force
This instruction is not OSX specific, it will work on all platforms, although on OSX it will work best with HomeBrew, when it's not installed only list of required software will be shown and you need to install it manually.
Many years later, the solution is changed because of brew upgrading, this works now:
# pull full brew git repo
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow
# generate new brew tap repo
brew tap-new $USER/old-openssl
# extract openssl 1.0.2t forumlar to $USER/old-openssl
brew extract --version=1.0.2t openssl $USER/old-openssl
# install old openssl from $USER/old-openssl repo
brew install openssl#1.0.2t
# reinstall ruby
rvm reinstall 2.3.4 --with-openssl-dir=`brew --prefix openssl#1.0.2t`
Try this.
rvm install ruby-2.0.0-preview1 --with-openssl-dir=$HOME/.rvm/usr --verify-downloads 1
This help me :
https://gist.github.com/Irio/1496746
$ rvm pkg install openssl
$ rvm remove 1.9.3
$ rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr
I uninstalled everything (rvm, rails, ruby, etc) on my macbook.
Installed homebrew
Installed rvm
Ran rvm requirements run force
Ran rvm install rails
rails new sample_app
cd sample_app
Note: source 'https://rubygems.org' is present in Gemfile, openssl is required!
bundle install and it worked!
No need to specify: --with-openssl-dir=$HOME/.rvm/usr
To resolve this, install openssl (preferably using brew).
Update Xcode to the latest version and enable command line installations using it.
Reinstall rvm using
rvm reinstall all
Note that rvm reinstall all --force
will delete all your previous installations of binaries/pkgs done using rvm.
Assuming ruby is already installed, do the following:
rvm cleanup all
rvm reinstall all --force
I got the same error, and the error was fixed by opening new terminal session.
I am using frum ruby version manager.
gem install openssl
worked for me, but nothing has declared depending on the openssl, its weired
Following command solved my issue
note 2.3.4 is the ruby version I am using, change as per your requirements
rvm reinstall 2.3.4 --with-openssl-dir=$rvm_path/usr
Make sure that $rvm_path is properly set, with command echo $rvm_path. If this path is empty, check if your home folder has .rvm folder.
In this case use
rvm reinstall 2.3.4 --with-openssl-dir=~/.rvm/usr

Resources