RVM can't install ruby on MacOS - ruby

I type this command :
$ rvm install 2.0.0 --with-readline-dir=$rvm_path/usr
Then i press "Ctrl+Z", So RVM is exit.
But When i type command again,
It's stop here...
So, How to resolve it , and install ruby right way?

This step depends on the bandwidth of your internet connection and configuration of your machine and can take upto 15 - 30 minutes. This first downloads(Bandwidth) the ruby binaries and then compiles(CPU + RAM dependent) it.
Also, in your case, its updating system packages.

You should not add --with-readline-dir=$rvm_path/usr - rvm handles this for you automatically.
As for the process - it takes long but should finish in less then hour (on slow internet connection and computer it could be few).
If the process does not show any changes in like 15 minutes you can try two things:
open another console/tab and monitor processes with top, on the top of list you should see something like ruby, curl, cc1, make ... but anything with more then 10-20% in the %CPU column will indicate - work is done.
break the process (CTRL+C) and start it again with:
rvm install 2.0.0 --debug
now it will show more details about what is going on - including log files where all outputs are redirected, you can watch those log files in other console with less (to see from start to current position) or tee -f (to see the changes as they happen)

Ok,I just restart my mac,then install again,that's all

Also just noticed the CTRL+Z - this can be holding some processes that block RVM - try running fg 1 - it should start the stopped process.
For more information about CTRL+Z vs. CTRL+C see https://superuser.com/questions/262942/whats-different-between-ctrlz-and-ctrlc-in-unix-command-line

To echo Nerve's answer and depa - I am fuzzy on why installing with RVM is such a pain - but Homebrew is going to be your best friend when it comes to doing the installations. I had trouble too.
Here is a link to a set up tutorial that i followed: http://tutorials.jumpstartlab.com/topics/environment/environment.html
Make sure homebrew (http://brew.sh/) is installed and if this is your first set up, try looking through the tutorial on set up and seeing if you missed anything
if that doesn't do it - some back and provide more information on what you've done so far and already have set up!

Related

How to remove all old Ruby versions (and version managers) and reinstall a single, tested version on macOS 10.14.6?

How do I remove (all old Ruby things), reinstall (preferably one and only one Ruby version), and test my entire Ruby environment (versionmgrs, gems, however this works) on my macOS 10.14.6 system using the "Ruby-community preferred" method (some install/version manager or similar vehicle)?
I'm seeking the entire procedure, for everything Ruby-environment related: Ruby "engine," version managers, .bash_profile edits, etc.
Even though we (my team) are not Ruby developers, we're running several Ruby-based apps like Asciidoctor. As such, we're simply users and are not invested in learning all the ins-and-outs of Ruby other than just trying to get apps (like Asciidoctor) to run without problems, and that's it.
1. Remove.
I want to completely remove every little Ruby file found on the system (besides the Apple.com-based default Ruby stuff that comes with macOS--I do not to remove or even use that stuff, ever, if I can avoid it). Hombrew-based, rbenv, and rvm, and any other Ruby thing/version_manager/intstalled_directory (there seems to be lots of different procedures and no one "standard install procedure--which is all confusing to us).
So please consider all the historical Ruby-isms that might have been installed for the entire history or Ruby, because chances are I've been installing them since the very early days of Ruby, and I/we still have the same macOS image we've been carrying forward (across upgraded MacBook hardware).
And it seems to make most sense to make sure this stuff is all gone (or at least moved out of a functional path) to ensure we have a clean slate to...
2. Reinstall.
What exactly we're installing and why we're installing it is unclear. Why do we need something to manage versions of Ruby, when we only want one? Is there some reason why we need multiple versions of Ruby? And do we have to separate Ruby "things" separate from a Ruby "version manager"? Is there a "Install Ruby for non-Ruby-developer dummies" resource to help guide us through this?
(I'm not familiar with the term "version manager" to describe the actual version of interpreter/compiler software. I'm used to, as a long-standing swdev manager, managing versions of the software my teams are developing. We're guessing this may be driven by the Ruby world may not try to enforce as much cross-Ruby-version compatibility, but we only speculate. Granted, we tend to do more system programming in C/C++/Python kind of things, and less web-specific stuff like JavaScript/Ruby things. Maybe the latter has less of "I'm a developer and I do not write portable code across version platforms / I'm a programming-language/platform designer that cares less about cross-version compatibility." This is a new world for us.)
3. Testing.
When done with #2, I would like to automatically diagnose my entire Ruby environment with a comprehensive system test. Is this feasible?
If I do not do this, history tells me that I'll run into a Ruby-wonky-environment problem later. If possible, I want to get "set and forget it," for everything, all in one shot and avoid running into future problems.
Think historical things like make test (after make and make install) and brew doctor.
More details
My Ruby environment/subsystem on my macOS 10.14.6 was wonky and broken and frustrating. Said environment was result of many years (decades) of Ruby stuff/layers piled into my macOS environment (which was cloned across MacBooks over time and therefore carried forward).
I tried to rebuild it and clean it up to try and get some level of sanity. It mostly (?) seems to work, at least for running. But rvm related stuff is still failing--and do I even need rvm (it's unclear, like many things in Ruby setup for non-Ruby developers). And I still have lots of ruby-isms hanging around in .bashrc that looks unhealthy (why so many $PATH entries..?), or at least makes me uncomfortable.
I've found at least 20 different "reinstall / rebuild" references on StackExchange.com and other places, many of which offer different Homebrew-based procedures.
My gem env output. Note all these different versions associated with some ruby-like component:
3.1.2, 2.7.0, 2.7.1, 2.2.1, 2.2.0, 1.1.2
That's six different subsystem versions. In my book, that's bad.
(I'm not a Ruby developer, so pls pardon my poor Ruby "syntax.")
Apparently Ruby community members are fixated on the concept of multiple versions of Ruby installed on one OS; from a classic, old-school system-administrators perspective (that's me), multiple installed Ruby versions is something my team specifically wants to avoid. Maybe there's some need to install multiple Ruby versions on one system. Maybe it's because Ruby offers less-stable environments (features, APIs, etc) than other software systems we're used to. Regardless: without knowing more, I'd much rather manage multiple versions of Ruby with containers (like Docker).
From the perspective of this user: the Ruby world feels chaotic and unnecessarily complex. With Ruby's popularity, I'm sure there's some reason for this. My guess: Ruby values feature advancement over platform stability. This is not greatest thing when I'm wearing my sysadmin hat; it can be kind of fun when wearing my swdev hat. For this mission, I'm only wearing my sysadmin hat.
I usually use RVM when I work on Linux OSs. However, there was a time when I worked on macOS. I tried many times to install RVM on macOS but was never successful, so I tried rbenv instead. It had its differences from RVM, but it did the job for me.
It might not be the answer you're looking for, but in case it is, here are the steps to install rbenv:
Type brew install rbenv in terminal to install rbenv.
Add the command eval "$(rbenv init -)" to ~/.bash_profile to make rbenv load automatically when you open terminal.
Type source ~/.bash_profile in the terminal to apply the changes you made to the current shell session.
Type type rbenv in the terminal to verify that rbenv is setup properly. Your terminal should display the following:
rbenv is a function
rbenv ()
{
local command;
command="${1:-}";
if [ "$#" -gt 0 ]; then
shift;
fi;
case "$command" in
rehash | shell)
eval "$(rbenv "sh-$command" "$#")"
;;
*)
command rbenv "$command" "$#"
;;
esac
}
And now, to install Ruby versions:
To check for available Ruby versions for installation, type rbenv install -l in the terminal.
To install Ruby 5.5.0, type rbenv install 5.5.0 in the terminal.
To check for installed Ruby versions, type rbenv versions.
To make Ruby 5.5.0 the global Ruby version on your system, type rbenv global 5.5.0 in the terminal.
To make Ruby 5.5.0 your Ruby version in your current directory, type rbenv local 5.5.0 in the terminal.
To check your current rbenv Ruby version, type rbenv version.
And of course, type ruby -v to make sure that the setup was done correctly.
Use a Full-Fledged Ruby Version Manager
You're trying to install one or more Rubies using Homebrew, and then hoping your gem environment stays sane. Don't. Just don't.
Installing Rubies via Homebrew can exhibit weird conflicts and difficult-to-resolve error messages. You'll be much better off installing a Ruby version manager like chruby, rbenv, or RVM. Not only will this generally work better, but it will segregate your gems on a per-interpreter basis so that you can easily clean up your Ruby environment when you inevitably run into problems with gems, libraries, or Xcode upgrades.
You'll need to install Xcode and its command-line utilities. Beyond that, I'd suggest chruby and ruby-install as the simplest integration solution, but any Ruby manager will do if you set it up correctly.
(Please make sure to see the Background section at the end of this answer.)
My procedure
1. Remove all the existing Ruby stuff (except for the Ruby "system" files installed by Apple for the "core system" for macOS).
This is the part of the procedure I'm less sure of. I've asked on superuser.com about "how to remove all possible, old Ruby cruft" and will import anything learned there to this procedure. In the meantime, I found a few things Ruby-related (eg: ~/.ruby-version) for which I could not easily find any documentation/reference. It was a mini adventure. But here's what I came up with:
a) Homebrew-based stuff: brew uninstall ruby ruby-build rbenv and any other Ruby-oriented Homebrew packages. brew list | grep can be helpful to find the packages.
b) rvm uninstall -- but please first read "old file droppings" notes below, in order to retain your old rvm environment for reference.
c) Any other uninstalls (non-Apple-macOS systems installs, of course) you can find or think of, possibly including installs that result from procedures found at https://rvm.io and https://github.com/rbenv/rbenv and any other version managers you can find/think of.
2. Remove or move old Ruby file droppings from $HOME
I moved the files instead of removing them, per the following procedure. Note that the ~/.rvm move effectively does some or all of the (1b) procedure above, while retaining the old ~/.rvm environment for (possibly very-helpful) reference, eg: to rebuild your installed-gems list. Also note that you may have more or less "file droppings" in your home directory.
cd $HOME
mkdir -p .ruby-old-files/2020-04-13
mv .rbenv/ .rvm/ .gem/ .ruby-version .ruby-old-files/2020-04-13/
3. (Re)install the latest, "stable" (?) rbenv/"ruby engine" per this one-line command (this presumes Homebrew is already installed), given the rbenv version manager choice as described in the Background section below:
brew update
brew install rbenv
The above does not install the "Ruby engine" via Homebrew; rather, it install rbenv (via homebrew), which in turn installs the "Ruby engine" per the following:
rbenv install $(rbenv install -l | grep -v - | tail -1)
rbenv global $(rbenv install -l | grep -v - | tail -1)
4. Comment/delete previous ~/.bash_profile updates from past Ruby-isms
I ended up commenting out all these lines from past Ruby-driven updates, which appear to be unused by and/or conflicting with rbenv (your file may not have anything like this):
#export PATH=$PATH:~/.gem/ruby/1.8/bin:/usr/local/opt/ruby/bin
#export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
5. Add this to ~/.bash_profile:
eval "$(rbenv init -)"
6. Start a new macOS Terminal.app window (or iTerm2 or similar).
7. [Optional] Re-install previous gems in new environment.
I looked at my previous .rvm bin list:
$ brew install tree
Warning: tree 1.8.0 is already installed and up-to-date
To reinstall 1.8.0, run `brew reinstall tree`
$ cd
$ tree -a .ruby-old-files/2020-04-13/.rvm/gems/ruby-2.2.1/bin/ -C | less
.ruby-old-files/2020-04-13/.rvm/gems/ruby-2.2.1/bin/
├── 3llo
├── _guard-core
├── asciidoctor
├── asciidoctor-safe
├── bundle
├── bundler
├── coderay
├── console
├── executable-hooks-uninstaller
├── github-markup
├── guard
├── imap-backup
├── listen
├── nokogiri
├── pry
├── rake
├── rdoc
├── ri
├── ruby_executable_hooks
├── setup
└── thor
0 directories, 21 files
$
(there's possibly other places to look for existing gems, as with Ruby stuff can be scattered all over the place with many "rubies" as the Ruby community calls them) and ran gem install [gem-package] for every package I wanted to reuse in my new (clean, fresh, and sane) Ruby environment. I ran some initial asciidoctor tests on my team's rather complex asciidoctor document library, and all seems initially good.
We'd prefer there be some sort of significant Ruby-engine set of "self diagnostics" (a simpler illustration: brew doctor) to give the user much more confidence that their "Ruby engine" is optimally functional. Alas, I as of yet see no such thing for Ruby.
From here moving forward I can gain more confidence in building multiple "rubies" via rbenv, and only rbenv. Before I had multiple rubies managed via multiple installers/version managers (Homebrew, rvm, and rbenv), which may have been a cause of many problems, possibly per Todd's point.
Background
Ruby has a bit of complexity and possibly runs much better with a version manager. I find this all a bit unusual, at least from my decades of swdev+sysadmin experience. I can certainly see how all these mechanisms can be very powerful. For now, I'm just trying to make my Ruby platform work.
From what I can tell, there is no "one standard way" to install and run and a standard directory to places in for Ruby on macOS. This means there's no "one standard way" to uninstall, and so one has to, if they've (often very unknowingly, like me) installed many different Ruby versions (I guess called "Rubies"?) over the years (decades?) in many different files/directories controlled by multiple different "version managers" (I guess? More on versions managers in a moment). ie, I find I have to "hunt and peck" for all the historical ways past Ruby installs/version_managers might have left file/directories placed in various areas.
Note this can happen when you have an macOS image that has lived for many years, and in my case, has been cloned across many generations of MacBooks. For someone who goes to a Ruby boot camp for a week and installs on a clean system, everything should work just peachy. For someone like me who's been an engineer/mgr for decades and possibly has all sorts of Ruby-isms laying around for his decades-old macOS image (as directed by many many different Ruby-based apps/guides on how I install stuff; not knowing that many of these procedures were effectively in conflict with each other), it can be quite the different story.
The Ruby platform apparently requires something called a Version Manager to run a Ruby platform (interpreter, compiler, engine, whatever it's called). I chose the rbenv (based upon this reference) version manager for the "install" portion of my procedure after removing/moving all the old stuff.
If it's not already obvious, it's (presumably?) best to avoid installing and running multiple version managers concurrently.
Installation options
There seems to be several ways to install the Ruby "core engine/platform" (my syntax, possibly only used by me) on macOS, with the 3-most-referenced options I've found noted below. (Note there are many other version managers to choose from not listed below.) I chose rbenv based upon this reference.
via rbenv
via rvm
via Homebrew
(1.) and (2.) above are mechanisms that can install Ruby, and these mechanisms can be installed via Homebrew. But #1 and #2 will not install Ruby via Homebrew. This can be confusing.
It appears (1.) and (2.) also enable multiple versions of Ruby to run concurrently. (3.) may not. This may be helpful due to version-to-gem/app compatibility challenges with Ruby's aggressive (?) feature movement, which sometimes comes at the expense of backwards compatibility. (I'm guessing here, but can come up with no other good explanation; community, pls comment.)
The "remove all old Ruby engines and files" approach might be extreme. My experience: Ruby's history is a mess, and over the years/decades it left all sorts of messy variances (in my home directory) lying around. It's not a big deal for me to rebuild gems by hand -- there's not that many on my system. And by keeping the pre-existing Ruby-environment files around I'm (hopefully) covered if ever I need to revert or rebuild stuff. And, for now, things feel much more "clean and sane" now that it "feels" like I've removed all the old cruft.
Even more background
My team and I are only users of Ruby-based applications, not Ruby developers, and are far from experienced in the Ruby realm. We just want to install and use and maintain applications like Asciidoctor without having to "dive in deep" on all this Ruby stuff. Everything worked okay for several years - and then all the "cruft" built up and started breaking things. When I tore it all down and properly reinstalled (above)--once I finally figured out how all the Ruby ins and outs worked--things starting working again. I believe that I, as a simple Ruby-application user, should not have to go to this level of effort just to get a Ruby app to work. In short: it should not be this hard. Hence the nature of my comments about the difficulty.
Further, I had a bad day when I first posted this question and unnecessarily aggravated several community members here that were trying hard to help--and again, my apologies, that was totally my bad--and I have since been labeled by some as the guy that "likes to complain alot." And I thoroughly deserve that label being inappropriate in a couple of my comments. Again, I apologize.
Additionally: my Ruby problems still exist whether or not folks here want to deny it or simply blame the problems on me for being mean. Regardless: I'm not disappointed with the people trying to help; I'm disappointed with the Ruby platform not supporting my overall experience well.
Please also note TamerB's helpful answer.

Apache Flink Installation 1.6.2 on Mac with Homebrew

I am trying to use Apache Flink for the first time for a school project, but I'm running into some trouble after installation. I have tried to follow the Quicksetup on the site, but I keep running into the same problem.
(https://ci.apache.org/projects/flink/flink-docs-stable/quickstart/setup_quickstart.html)
Console Output
The brew installation seems to work fine, this is where I ran into the first inconsistency however. Next the guide tells me to execute the following line
$ ./bin/start-cluster.sh # Start Flink
which doesn't work without installing a binary from here though
https://flink.apache.org/downloads.html
So I did that (I downloaded the Flink 1.6.2 with Hadoop 2.7 binary) and was then able to find the file and execute it. After doing this I'm supposed to go the the web frontend, and verify that a task is running. However when I go there nothing is shown.
Console Output
Web Dashbord
I started by executing the stop-cluster file, because for some reason I'm constantly getting the INFO Message
[INFO] 1 instance(s) of standalonesession are already running on Moritzs-MBP.fritz.box.
So far I have tried to to look into the flink-conf.yaml file which does set the numberOfTaskSlots to 1, so the problem does not seem to lie there. Otherwise I didn't really know where to look from there however and only tried to uninstall the and reinstall everything with no results however.
Sorry that the images are not shown, previously I had been able to fix all my code problems with existing posts and thus I can't directly post them yet. Any help would be much appreciated, thanks in advance,
Moritz
By using brew installation, the start-cluster.sh should be able to found in:
/usr/local/Cellar/apache-flink/1.6.2/libexec/bin
I'm not sure why start-cluster.sh isn't succeeding in starting up a taskmanager, but you can always (try to) start another one by hand with
$ ./bin/taskmanager.sh start

heroku toolbelt command issues

I installed the Heroku Toolbelt following the instructions provided by RailsBridge's Installfest for Windows. I am running Windows 10 64-bit and the Command Prompt with Ruby and Rails provided by RailsBridge.
Each heroku command I attempt to input, be it 'version', 'login', or what have you, I get this:
heroku-cli: Adding dependencies... done
heroku-cli: Installing core plugins...Error reading plugin: heroku-cli addons.
Then I see a list of which plugins that there were reading errors for. The list is:
heroku-apps;
heroku-fork;
heroku-git;
heroku-local;
heroku-run;
heroku-status
Then:
ERROR: runtime error: invalid memory address or nil pointer dereference
Then it repeats this, adding dependencies, attempting to install core plugins, same reading plugin errors, but then after the runtime error runs again, it prints this:
! error getting commands pid 5052 exit 1
Previously, it was 'error getting commands pid 6912' or something like that. I looked around a bit and didn't see anything that specifically dealt with this, but I am sorry if I missed it before asking this question. I'm very new at this.
I would really appreciate any help or advice on how to correct this. I thank you very much ahead of time!
Edit: I now understand what pid is. Using another resource, I was told to check for the pid process in my task manager. I reran this process, got a different pid number, and searched for it in my task manager but to no avail. It isn't storing it.
I had the same problem and Heroku support team was quick to answer with:
can you delete ~/.heroku/heroku-cli and try again?
Next time you run a heroku command it will reinstall the toolbelt. Worked for me.
According to the support team it happened because:
It was a bug that was pushed yesterday we fixed this morning that some users ran into.
Good luck!

Install gcc49 via homebrew failed

I am trying to install gcc49 via homebrew.
I give a command like:
brew install gcc49
but it is stuck at
==> ../configure --build=x86_64-apple-darwin13.0.2 --prefix=/usr/local/Cellar/gc
==> make bootstrap
It takes quite sometime. I did not time it per se - but I left it working for around 1.5 hours before I returned to the window - then it was done. So timewise anything between 15 min and 1.5hrs I'd say. If you are running your terminal in a window and text keeps changing in the header it's all good. Just don't cancel it - let it do it's work. If you have other things to do, get those done first; if not - go on youtube :)
It takes time. On my computer it takes about 1 hour. so just be patient and let it works. Even sometimes the header of Terminal does not change and stop on "cc1plus". Don't cancel it and do other thing until it will be done :)

How can I install Maglev with rvm on Mac OS X Lion?

I am trying to install Maglev on Mac OS X Lion with rvm, but running
rvm install maglev
as instructed on the github page only yields a 404 error:
curl: (22) The requested URL returned error: 404
ERROR: The requested url does not exist: 'http://glass-downloads.gemstone.com/maglev/MagLev-26852.Darwin-i386.tar.gz'
which does not seem too helpful, as it just points out that the respective file does not exist on the gemstone server. Google does not seem to know about this, so I thought about asking a question here. However, before doing so I tried some more and and got a little further running
rvm install maglev-head
as mentioned in some blog posts. This finally finds an appropriate file, downloads a bunch of things and starts to compile. It starts to look really well at a point where it says
Installing maglev to /[user-dir]/.rvm/rubies/maglev-head
in green, but unfortunately it does not get much further. The installation hangs after saying
Creating default 'maglev' repository.
Generating maglev HTML documentation
Generating smalltalk FFI.
or at least it takes forever (more than 30 minutes) without saying anything.
Stopping the installation at this point still looks promising giving me
$ rvm list
rvm rubies
maglev-head [ x86_64 ]
but unfortunately
rvm use maglev-head
results in
startstone[Info]: Starting Stone repository monitor 'maglev'.
startstone[Error]: Stone process (id=61119) has died.
startstone[Error]: Examine '/[user-dir]/.rvm/rubies/maglev-head/log/maglev/maglev.log' for more information. Excerpt follows:
without displaying an excerpt and even without stopping. Actually the log file does exist and has a few error messages, the most telling seems to be
GemStone is unable to open the file !TCP#localhost6#dbf!/[user-dir]/.rvm/rubies/maglev-head/data/maglev/extent/extent0.ruby.dbf
but the directory does exist, it would just be the file that is missing, and I would expect the server to create that one on an new image. Still, the situation does not look too bad as i get
which irb
giving me
/[user-dir]/.rvm/rubies/maglev-head/bin/irb
but when I try to start up irb I get
maglev-ruby: [Error] The MagLev server "maglev" is not running.
To fix this run "rake maglev:start" before running maglev-ruby.
but if I call the rake task as instructed I again get
maglev-ruby: [Error] The MagLev server "maglev" is not running.
To fix this run "rake maglev:start" before running maglev-ruby.
putting me in a recursive causality loop. Trying to start the maglev server by hand using
maglev start
as I did on a previous installation using the shell scripts does not work either, giving me
startstone[Info]: Starting Stone repository monitor 'maglev'.
startstone[Error]: Stone process (id=61400) has died.
startstone[Error]: Examine '/[user-dir]/.rvm/rubies/maglev-head/log/maglev/maglev.log' for more information. Excerpt follows:
again without displaying an excerpt and hanging.
Any help would be appreciated as Maglev looks like a really promising piece of infrastructure.
You need to do "rvm get head" first; I can see it was looking for MagLev-26852.Darwin-i386.tar.gz, which was for an older version both of MagLev and of RVM.
I'd do an "rvm remove maglev; rvm install maglev" It shouldn't take more than a few minutes then to build once it's downloaded.

Resources