rbenv on wsl shows ruby version 2.5.0-dev - windows-subsystem-for-linux

I installed rbenv on WSL but it only shows that I have ruby 2.5.0-dev. I checked ruby's website and it showed 3.1.2. I then checked rbenv on github and it showed that the updated rbenv is 3.1.2.

Note that the version of rbenv that is packaged and maintained in the Debian and Ubuntu repositories is out of date. To install the latest version, it is recommended to install rbenv using git.
Use this to install the latest version: https://github.com/rbenv/rbenv#basic-git-checkout

Related

YAML safe loading is not available

When I want to install compass with gem install compass, I occurred with this error:
YAML safe loading is not available.
Please upgrade psych to a version that supports safe loading (>= 2.0).
what The cause of this error and how can I solve the problem?
It sounds like the psych gem needs to be updated. Try running gem install psych and then gem update psych.
Suggested by looking at the psych readme file here: https://github.com/ruby/psych/blob/master/README.md
EDIT: you might also have to update your version of ruby. This depends on how you have installed ruby, but #ewerx has one suggestion in their answer.
To resolve this I first upgraded Ruby from 2.0.x to 2.4.2 (https://gorails.com/setup/osx/10.12-sierra):
rbenv install 2.4.2;
rbenv global 2.4.2
Then updated gems:
sudo gem update --system;
gem update
It may be sufficient to just update gems.
The following part of the post on https://gorails.com/setup/osx/10.12-sierra solved my issue.
We will be setting up a Ruby on Rails development environment on macOS 10.12 Sierra.
Older versions of OS X are mostly compatible so follow along as far as you can and then Google search for any problems you run into. There are plenty of people who have documented solutions for them.
Installing Homebrew
First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source.
Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes.
Open Terminal and run the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing Ruby
Choose the version of Ruby you want to install:
Now that we have Homebrew installed, we can use it to install Ruby.
We're going to use rbenv to install and manage our Ruby versions.
To do this, run the following commands in your Terminal:
brew install rbenv ruby-build
Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
Install Ruby
rbenv install 2.5.1
rbenv global 2.5.1
ruby -v

Install old version of phantomjs

I want to install an old version of phantomjs (1.9.1). If I run
brew install phantomjs
It installs the new version (2.0.0).
You can find supported prior versions in the homebrew-versions repository. There isn't a formula for 1.9.1 but you can install 1.9.2 with brew install homebrew/versions/phantomjs192. (You could contribute one for 1.9.1 if you really need it.) You can look for versioned formulas with brew search phantomjs.
Please, try this command:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/master/phantomjs182.rb

Deploy Rails 3 with Phusion Passenger on Ubuntu WITH ALL GEMS INCLUDED

I need to deploy a Rails 3/Phusion Passenger/Apache2 app to an Ubuntu 12.04 server without installing ANY gems on the server.
I can install any Debian packages.
How can I include all needed gems (including Rails, a couple of gems installed from git projects on github, and a bunch of regular gems installed from rubygems.org) inside my project so that, after deployment, Passenger will find Rails and all the gems and be happy?
(I know many people will probably be curious WHY I would want to do this. I can't talk about that, unfortunately. Sorry.)
Here are some things that have not worked. One of them might work if revised a little, I don't know:
Failed method 1:
On Ubuntu 12.04 dev machine. Ruby 1.9.3. Bundler 1.3.5. bundle package --all. Git commit.
On Ubuntu 12.04 server machine (gem installation from Internet not possible). Deploy project files and install packages (apache2, ruby1.9.3, ruby-bundler, rubygems, libapache2-mod-passenger which brings ruby1.8 with it). bundle -v gives Bundler version 1.0.15 (from ruby-bundler package). Make sure .bundle/config file from dev machine is also deployed. bundle install --local tries to download git gems from github, so fail.
Try using bundle package --all, which should save your gems into ./vendor/cache. You could also unpack the gems on your local environment with gem unpack --target vendor to save them in the vendor directory. Then you can give a location in the Gemfile so that your application can find the gems. Can you just not use the network to install gems, or are you really not allowed to install gems in any way?
Sources:
1,
2
Try using the pkgr tool, which can convert your Rails app and all dependencies into a single installable Debian package.
Download the bundler 1.3.5 gem from http://rubygems.org/downloads/bundler-1.3.5.gem and put it in vendor/
In an Ubuntu 12.04 vm, do bundle package --all. Git commit and push.
Clone on the Ubuntu server.
apt-get install each of apache2, ruby1.9.3, etc. (not rubygems or ruby-bundler. Both provide an old version of Rubygems and Bundler. A newer version of rubygems is included in the ruby1.9.3 package.)
Follow ALL of the instructions in section 2.3 at http://www.modrails.com/documentation/Users%20guide%20Apache.html#install_on_debian_ubuntu
Make sure you have the right Ruby and Rubygems versions set to the ruby and gem commands:
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.3 200
update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.9.3 200
(Phusion Passenger doesn't care about this, but it's probably a good idea for the gems we are about to install and for debugging stuff with the Rails console or whatever in the future.)
gem install --local vendor/bundler-1.3.5.gem
bundle install --local
Set up all your other Apache config...
service apache2 restart

Installing wkpdf in rbenv environment

I have a clean install of mountain lion 10.8.2 and have installed rbenv and gem installed wkpdf. When I try and run wkpdf, I get the following message:
xxxx-MacBook-Pro:~ xxx$ wkpdf --help
Cannot load RubyCocoa library
wkpdf requires that RubyCocoa is installed, which is shipped by default since
Mac OS X 10.5. If you use Mac OS X 10.4, you have to install RubyCocoa
yourself from http://rubycocoa.sourceforge.net/HomePage
Is possible to run wkpdf in the rbenv environment? (I have posted a similar question on rbenv github but have not yet had a response)
It's possible that you have installed wkpdf in a Ruby version other than "system" one. Check your active version with rbenv versions.
When installing and using wkpdf, ensure that you've selected the "system" version:
RBENV_VERSION=system gem install wkpdf
Also when using the gem, you must use "system" version as well for executing code in your project, or the gem won't be found.
It seems that because of the nature of how wkpdf works, it relies on executing within system Ruby on OS X.

Installing newer version but still older version active

I needed some features from a newer version so I installed 1.9.3 . However after the installation when I write "ruby --version" it still gives me back 1.8.7.
Any idea how to update it?
I used rvm install ruby-1.9.3-p0 to install it, and this worked on other machines, just not on this one
there is a shortcut for your needs:
rvm use 1.9.3-p0 --install --default
where:
--install will install this ruby if it is not yet installed
--default will set this ruby default so it will be loaded when you open new shell