JRuby stops installing mid-process via RVM - terminal

I'm currently attempting to install JRuby via RVM on Mac OS X Mountain Lion. However, during the process of installation, the process seems to suddenly stop without an error. I wasn't sure whether or not the install was done, so I tried to use the jruby command. I received an error stating that there was no such command available. I've also tried to re-install JRuby a few times, as well.
The output from RVM looks as follows (this is a re-install):
MacBook-Pro:~ USER$ rvm reinstall jruby
/Users/USER/.rvm/src/jruby-1.7.2 has already been removed.
Removing /Users/USER/.rvm/rubies/jruby-1.7.2...
http://jruby.org.s3.amazonaws.com/downloads/1.7.2/jruby-bin-1.7.2.tar.gz - #configure
jruby-1.7.2 - #download
jruby-1.7.2 - #extract
jruby-1.7.2 - #validate
jruby-1.7.2 - #setup
Saving wrappers to '/Users/USER/.rvm/bin'.
jruby-1.7.2 - #importing default gemsets (/Users/USER/.rvm/gemsets/), this may take time ...
Making gemset jruby-1.7.2 pristine.
Making gemset jruby-1.7.2#global pristine.
At this point, the installation seems to suddenly end, and I'm back to MacBook-Pro:~ USER$.
Any ideas? Thanks a bunch!

this is proper flow, everything worked as expected, it did not stopped half way - it finished successfully.

Related

Trying to uninstall and fresh install Ruby on Ubuntu: do I still have Ruby installed?

I'm coming from Windows to Linux (Ubuntu) so I'm new to the CLI. I had issues trying to install Rails so I figured a fresh install would help. I'm following "Installing Ruby the Correct Way."
I thought I had uninstalled Ruby, but after installing 2.1.4 it still shows some Ruby folders. Have I completely uninstalled Ruby?
Downloading ruby-2.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/bf9952cdeb3a0c6a5a27745c9b4c0e5e264e92b669b2b08efb363f5156549204
Installing ruby-2.1.4...
Installed ruby-2.1.4 to /home/richard/.rbenv/versions/2.1.4
richard#richard-ThinkPad-T400:~$ rbenv global 2.1.4
richard#richard-ThinkPad-T400:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
richard#richard-ThinkPad-T400:~$ sudo rbenv global 2.1.4
richard#richard-ThinkPad-T400:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
Are the "the following packages" on my local system? or are they online?
EDIT
I've been getting this error when I try to install RVM (and some other applications):
GPG signature verification failed for '/home/richard/.rvm/archives/rvm-1.26.0.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc'!
try downloading the signatures:
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
they can be compared with:
https://rvm.io/mpapis.asc
https://keybase.io/mpapis
Does this have anything to do with it? I wouldn't really think so but I'm a noob.
Don't sudo rbenv anything or you will summon Cthulhu. Use rbenv by itself.
Also, don't randomly follow guides on the internet until you're more familiar with your OS; They go stale, or start out wrong, or don't accurately apply to what you're doing. Instead, go to the source and follow the directions there.
To find out what is installed on your machine, use locate to quickly find Ruby instances. Something like:
locate /bin/ruby | grep -v .rbenv
should narrow down whether multiple Rubies are installed outside the ~/.rbenv directory.
Traditionally, you'll find a normally installed system-wide Ruby in /usr/bin/ruby. A user installed one from source will probably be in /usr/local/bin/ruby unless you specifically said otherwise, probably with a PREFIX= directive.
rbenv will default to installing Ruby in the ~/.rbenv hierarchy since it acts like a sandbox manager and will put all Rubies it installs underneath that directory. RVM, a similar application, will use ~/.rvm, and in both cases, the purpose is to keep them where the user's permissions are sufficient to install and update gems without requiring the use of sudo. For general use, avoid sudo unless you understand what you're about to do, as it can turn a computer into an under-desk heater in seconds.
The shell uses the PATH variable to figure out where to look for executable commands. It sounds like your PATH isn't set correctly. If you followed the directions on the rbenv site, they say how to enable rbenv by modifying your ~/.bash_profile script. Doing that, then closing and reopening your shell should bring rbenv to life.
Following that blog post, you are installing Ruby using a tool called rbenv, and if you only uninstalled one Ruby, that doesn't mean that all Rubies are uninstalled.
The message that you posted shows that it is a local install: Installed ruby-2.1.4 to /home/richard/.rbenv/versions/2.1.4 which is a copy of the 4th line of your message.
You can find out from whence your Ruby executable is being invoked by issuing at the command line:
which ruby
You will then know if the program is available and which it is. Using ruby -v if it is there will tell you the version.
You have done some of these steps and are finding out that your system does not know how to get to the Ruby, if it is indeed installed.
Right now, it is effectively uninstalled, as it is unavailable to your environment.

Problems updating RVM to upgrade to ruby 2.0.0

I am trying to upgrade to ruby 2.0.0 and I am running into problems getting rvm updated:
Here is my first error trying to update to ruby-2.0.0[-p353]:
Error running 'requirements_smf_update_system ruby-2.0.0[-p353]',
please read /usr/local/rvm/log/1385828966_ruby-2.0.0[-p353]/update_system.log
Requirements installation failed with status: 1.
So I tried:
rvm get stable --auto-dotfiles
And got the following warnings:
Can not update 'scripts/extras/completion.zsh/_rvm', it's a conflict between Zsh
and multiuser installation, prefix the command with 'rvmsudo' to update this file.
but it alerted that install was complete. When I run:
rvm usge:
I get this warning:
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-1.9.3-p194/bin' is not
at first place, usually this is caused by shell initialization files - check them for
'PATH=...' entries, it might also help to re-add RVM to your dotfiles:
'rvm get stable --auto-dotfiles', to fix temporarily in this shell session run:
'rvm use ruby-1.9.3-p194'
And I'm going in a circle. I would like to read:
/usr/local/rvm/log/1385828966_ruby-2.0.0[-p353]/update_system.log
but I don't know where to find it. I must have accidentally set up rvm with multiuser instead of single user but I can't be sure because I used to tutorial to set is up.
Does anyone have any ideas?
Thanks in advance.
In ruby-2.0.0[-p353] the brackets [] mean optional so you can either write:
rvm install ruby-2.0.0
OR:
rvm install ruby-2.0.0-p353

RVM install ruby from local source

I can't believe the this isn't a more frequently asked question.
I want to install ruby 1.9.2, and I want it as part of my RVM installation. The link for 1.9.2 has since 404'd on the ruby-lang site, so I copied the tar.gz from the ruby github page, rezipped it into a tar.bz2 like rvm requires and dropped it into ~/.rvm/archives
However, every time I call rvm install 1.9.2-p320 it deletes the source tar.bz2 from ~/.rvm/archives and tries to redownload the tar.bz2 from the ruby-lang site.
The --force and --disable-binary options do nothing to prevent the deleting and redownloading attempts.
Is there a way to point rvm explicitly to the source tar.bz2? I'd like to avoid compiling from source myself and then copying the directory into wherever rvm needs it.
Note: It looks like the ruby-lang ftp server is just down for the moment which explains why the download keeps failing, but my question still stands as this seems like good functionality for rvm to have.
The deletion of archive is controlled with --verify-downloads flag:
rvm install 1.9.2-p320 --verify-downloads 2 --disable-binary
Values for the --verify-downloads flag:
0 - has to have checksum and must validate
1 - does not have to have checksum, if available must validate
2 - continue even the checksum does not validate
The front page of ruby-lang.org does mention that some services would be down, I'd suggest waiting for them to get their services back up and trying again.
http://www.ruby-lang.org/en/news/2013/08/06/status-issue/
rvm usage clearly said
rvm [Flags] [Options] Action
The correct syntax for your problem is
rvm --verify-downloads 2 --disable-binary install 1.9.2-p320
rvm will check the flags and options first before executing any action

Jekyll - command not found

I am trying to get Jekyll running but I have no experience with Ruby.
As far as I can tell the installation of Jekyll has succeeded.
However:
$ jekyll
Gives an error:
-bash: jekyll: command not found
This is the gem env result:
- RUBYGEMS VERSION: 1.3.4
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Volumes/HDD/DADU/gems
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /Volumes/HDD/DADU/gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Volumes/HDD/DADU/gems
- /Volumes/HDD/DADU/.gem/ruby/1.8
- /Library/Ruby/Gems/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
And I found the following paths leading to "something" Jekyll:
~.gem/ruby/1.8/gems/jekyll-0.11.0/lib/jekyll.rb
~.gem/ruby/1.8/gems/bin/jekyll (exec file)
If you are using MacOS, from the Troubleshooting guide:
Jekyll & Mac OS X 10.11Permalink
With the introduction of System Integrity Protection, several directories that were previously writable are now considered system locations and are no longer available. Given these changes, there are a couple of simple ways to get up and running. One option is to change the location where the gem will be installed (again, using sudo only if necessary):
$ gem install -n /usr/local/bin jekyll
For others coming here with the following set up:
OS X + brewed install of ruby + (possibly) zsh
I figured the problem is that after installing jekyll as per their instructions, gem installs the jekyll gem in the brew cellar, not where the OS usually expects it (somehwere in a gem directory for ruby).
So, all that was needed here was to find out where the brew install of ruby installs gems, locate the jekyll binary, and create a symbolic link to it in /usr/bin.
Here is are the steps I took to fix it:
Type gem env and look for GEM PATHS. For me it was:
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1.
Make sure you can see the jekyll binary in the directory from 1 above and copy its path (if you can't, search any other paths listed in GEM PATHS for it). For me it was:
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/bin/jekyll
Use the path from step 2 above to create a symlink to /usr/bin/jekyll. I did it by typing this (you might need sudo to create the symlink):
cd /usr/bin && ln -s /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/bin/jekyll jekyll
Now all should be merry if you type jekyll.
The easiest method of doing this is to use RVM. It manages Ruby and all its gems for you and it's easy to use. See this link for using it.
If you did not want to use that you will need to modify your PATH variables so it can find your gems. I have found this to be tedious and reverted to RVM, but here are the general steps.
You will need to find out where your gems are getting installed. If you did gem install ... the gems will be in ~/.gem/ruby/1.8/gems/bin, if you used sudo gem install ... the gems will be somewhere in /System/Library/Frameworks/Ruby.framework/Versions/1.8/Resources
You have to add this path to your PATH variable. Easiest way to do this is by running :
echo 'PATH=$PATH:above/path/to/gems' >> ~/.bash_profile
If you are using RBENV instead of RVM you simply need to run rehash in the command line after installing jekyll:
rbenv rehash
I installed my ruby2.6.0 and gem via brew on MacOS 10.14.
For me, add the following line to my ~/.zshrc solved this issue.
export PATH=/usr/local/lib/ruby/gems/2.6.0/bin:$PATH
I found jekyll executable file with command locate jekyll.
Maybe a little late, but...
I had some trouble to install Jekyll on Ubuntu and tried everything that people answered in this thread - unfortunately nothing worked.
Then, I watched a video on Jekyll's site and after installing the whole ruby package again, sudo gem install jekyll worked.
Try it before anything else:
sudo apt-get update
sudo apt-get install ruby-full
sudo gem install jekyll
jekyll -v
It seems pretty simple, but it works on Ubuntu.
One solution would be editing your ~/.bashrc file and add this line:
PATH=$PATH:~/.gem/ruby/1.8/gems/bin
This will add ~/.gem/ruby/1.8/gems/bin in Bash's lookup path.
Reopen the terminal and it should work. Or you can use the following command:
. ~/.bashrc
Following steps solved my problem
gem uninstall jekyll
sudo gem install jekyll
Open ~/.bash_profile and add this code in the last line,
export PATH=$PATH:/usr/local/lib/ruby/gems/1.9.1/gems/jekyll-2.5.2/bin
Save and close the .bash_profile
Close and reopen the mac terminal, try running jekyll now, it should work
For me, I followed this installation guide instead of their main page's installation instruction. It worked after I changed the bash_profile file and restarted Terminal.
Jekyll is a ruby gem : Ruby gems in linux, for example, are in /var/lib/gems/1.8, as can be seen in the "ruby env" output.
Thus, you need to add the executables in this directory to your path.
In general, if a ruby gem is "not found" by your OS, it simply indicates that either
1) You don't have the gem installed or
2) You don't have the gem installed in a directory that is on your path.
I have found that there have been a few issues with installing ruby and ruby gems on linux (I have found that it can be tricky on Ubuntu v10, and have confirmed this with the Ruby folks on IRC). Thus, tools like RVM or rbenv might be the best approach to setting up a stable, maintainable ruby environment.
Easier than creating a symlink just install it correctly.
If you got permission errors like a lot of people are getting when trying to use
gem install jekyll
instead use
sudo gem install jekyll
#jayunit100,
I'm running into the same issue with a Jekyll blog. I've installed the gem via RVM in a 'Blog directory and the _config.yml file says that it should generate into Blog/_site. Is it as simple as adding Blog to the PATH or is there something else I'm missing?
Update: My bad, I didn't really have the gem installed. Lesson learned: rvm requirements and brew doctor are there for a reason - before you install stuff USE THEM
In my case I had to run bundle install --force
Then bundle exec jekyll serve works, but jekyll serve still doesn't. It seems I'll have to go with the former from now on…
When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/.gem/ruby/1.9.1. The commands provided by the gems you installed will end up in ~/.gem/ruby/1.9.1/bin. For the programs installed there to be available for you, you need to add ~/.gem/ruby/1.9.1/bin to your PATH environment variable.
For example, if you use bash you can add that directory to your PATH by adding code like this to your ~/.bashrc file:
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
https://guides.rubygems.org/faqs/#user-install
I put it in the .bash_profile (Mac OS X).
https://hathaway.cc/2008/06/how-to-edit-your-path-environment-variables-on-mac/
Here's an updated answer for 2020 (soon 2021). To install any Ruby gem, whether it's Jekyll, Bundler, Rails, etc., you need a proper Ruby development environment on a Mac. There are various ways to install Ruby on a Mac, as I have written about in great detail in my definitive guide to installing Ruby gems on a Mac. The only one I recommend is to use a Ruby manager because it's the most flexible and sets you up for success for the long term. My preferred one is chruby because it's the lightest and easiest to use. As part of installing Ruby, you also need to properly configure your shell startup file (typically ~/.zshrc or ~/.bash_profile) so that it knows where to find the gems you install. Otherwise, you'll get the "command not found" error, which I've also written about.
Since there are several steps involved in setting up a working Ruby development environment on a Mac, I wrote some scripts to automate the whole process and make things easier and faster for people. You can read more about the scripts in my guide mentioned above.
I had this problem for a very stupid reason, which is that I was working on Linux and had installed both flatpak and .deb versions of Visual Studio Code. I was confused because I could successfully run bundle exec jekyll serve in the terminal application, but not from the integrated terminal in Visual Studio Code.
Well, it turns out the integrated terminal loaded my PATH correctly in the .deb version but not the flatpak one. So... if you, like me, have foolishly installed multiple versions of Visual Studio Code, check which one you are using.
This is what worked for me. I'm not developing in ruby, and don't have a lot of tools that I use it for, so I don't need RVM. I also don't need to install jekyll as root. I just want it to run.
(This answer is just a more descriptive version of answers by Santa Zhang, jayunit100, and a few others.)
1. Find Local Gem Path
> gem env
Assuming this runs, it will list a bunch of useful information. You are looking for GEM PATHS. If there are two, then you want the one that is found in your home directory. Mine was something like /home/<user>/.local/share/gem/ruby/3.0.0
If it doesn't run, install the ruby gem program and try again.
2. Find Gem Binaries Path
Look in that directory until you find the location where the jekyll executable is actually installed. I found it in /home/<user>/.local/share/gem/ruby/3.0.0/bin/jekyll. But what I need is the directory path, not the file, so: /home/<user>/.local/share/gem/ruby/3.0.0/bin/.
3. Add That to PATH
Figure out how to add a directory to your PATH environment variable. Instructions for that are too extensive to provide here, as it depends on your operating system and preferred shell, and the versions of the same. Search for that information elsewhere on Stackoverflow.
4. Restart Your Session
Close your terminal and open a new one. Make sure the directory was added to your path. Depending on how you set your PATH variable, you might need to log out of your session and log in again.

RVM - is there a way for simple offline install?

I would like to install RVM in an offline machine - I can manually transfer any file needed, but it'll be impossible to have an internet connection. Not being online causes RVM to collapse when trying to download source files for ruby or other dependencies (zlib, etc).
I'm looking for a way to point RVM to the location of ruby source folder, e.g. something like rvm install 1.8.7 --source=/path/to/ruby-1.8.7-p330/, or any other dependencies. I've scoured the rvm docs but either missed something or it's not there. Any other suggestions as to how to accomplish this installation are also welcome. thanks.
When rvm downloads a version of ruby it saves it to .rvm/archives. So you can drop the .tar.bz2 source of ruby into that directory and rvm will use that instead of trying to download it:
cp ruby-1.8.7-p330.tar.bz2 ~/.rvm/archives/
rvm install ruby-1.8.7
set up a second machine (source) with identical user account, and use that machine to install RVM, to install Ruby and all the Gems you need...
Then, once you have installed all the things you need, use rsync to copy the complete ~/.rvm directory from your source machine to your offline machine. rsync is your friend!
If you don't have an internet connection on the offline machine, use a flash drive, and copy everything with 'cp -rp' to the flash drive -- then onto the offline machine.
Note: the name of the user account has to be the same on both machines!
If you don't use the same user names, you will run into some weird error messages later... RVM memorizes the complete path where a gem or ruby version was installed -- it doesn't use the $HOME variable. If you use the same user account on all machines for deployment, you won't see those errors.
Maybe it is not the simplest but RVM provides documentation for the offline installation: http://rvm.io/rvm/offline - it also includes information how to deploy your application offline.
Also need help with this, and I'm too poor to comment.
None of the above solutions work. The RVM-offline doc doesn't help at all. No matter what I do, it wants to install from source, which is not helping.
How do I hint or force RVM to use the global archives directory?
Maybe the question is: once the ruby tree is in place, how to tell RVM that it's there and can be used?
Found the answer.
Put the binary in the archives directory, as suggested by the rvm site, then mount it.:
cp rvm-binary-2.x.x-pyyy.tar.bz2 /usr/local/rvm/archives/ # or whichever
rvm mount -r /usr/local/rvm/archives/rvm-binary-2.x.x-pyyy.tar.bz2
Now you might get output like this:
/usr/local/rvm/archives/bin-ruby-2.0.0-p598.tar.bz2 - #configure
ruby-2.0.0-p598 - #download
ruby-2.0.0-p598 - #validate archive
ruby-2.0.0-p598 - #extract
ruby-2.0.0-p598 - #validate binary
Libraries missing for ruby-2.0.0-p598: libyaml-0.so.2. Refer to your system manual for installing libraries
showing that you are on the right track. After installing yaml, I redo the rvm mount -r op and get:
/usr/local/rvm/archives/bin-ruby-2.0.0-p598.tar.bz2 - #configure
ruby-2.0.0-p598 - #download
ruby-2.0.0-p598 - #validate archive
ruby-2.0.0-p598 - #extract
ruby-2.0.0-p598 - #validate binary
ruby-2.0.0-p598 - #setup
ruby-2.0.0-p598 - #gemset created /usr/local/rvm/gems/ruby-2.0.0-p598#global
ruby-2.0.0-p598 - #importing gemset /usr/local/rvm/gemsets/global.gems..............................
ruby-2.0.0-p598 - #generating global wrappers........
ruby-2.0.0-p598 - #gemset created /usr/local/rvm/gems/ruby-2.0.0-p598
ruby-2.0.0-p598 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.0.0-p598 - #generating default wrappers........
After which I verify:
rvm use 2.0.0-p598
And we're good to go.

Resources