Ruby: RVM Install Error "Could not source..." - ruby

A reinstall of RVM produced the following errors when done:
WARNING:
Could not source '/Users/developer/.rvm/scripts/base' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/version' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/selector' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cd' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cli' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/override_gem' as file does not exist.
RVM will likely not work as expected.
cat: /Users/developer/.rvm/VERSION: No such file or directory
/Users/developer/.rvm/src/rvm/scripts/rvm: line 133: __rvm_conditionally_add_bin_path: command not found
I reinstalled after I wrestled with trying to get RVM to work with Textmate and RVM behavior became strange (reporting it didn't have gemsets it would list) so I ran:
rvm implode
... and then manually removed the executable. Then I ran the install again by scrupulously following the single user instructions from the home site.
After I spotted the errors, I investigated the paths and found that many files in ~/.rvm/scripts/ and ~/.rvm/src/rvm/scripts/ which obviously should be executable did not have execute permissions.
RVM would not run at all so I set the executable bit on all the files in the two directories and that seems to have fixed things. (So far at least.)
Googling, it seems that other people have hit this problem but there seems to be no explanation or resolution. I would like to find out if this is a known issue and whether I should reinstall yet again.
I'm running rvm 1.6.9 on MacOS X 10.6.7

Yep. If you have installed system-wide it is definitely looking for both the system-wide configuration... and some hard-coded user scripts. Which is weird.
quick fix:
ln -nfs /usr/local/rvm /Users/developer/.rvm

it looks like all you need is to create that missing file.
in your terminal type:
touch /Users/developer/.rvm/scripts/version
touch /Users/developer/.rvm/scripts/base

they are warnings, not errors. I've got similar ones on my ubuntu linux box (but not on another, with same RVM version). so, it's not strctly related to OSX.
your RVM installation should work anyway.

Related

Bad Interpreter No Such File or Directory - Docker Sync

When trying to start my Docker container and sync it up using Debian, I consistently encounter this error message after entering in "docker-sync-stack start"...
-bash: /c/RailsInstaller/Ruby2.3.3/bin/docker-sync: C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe: bad interpreter: No such file or directory
I'm fairly sure this is a path issue, but I can't seem to resolve it.
It seems you do not have Ruby installed on your system. That sometimes happens after a system upgrade.
There have been discussions about this
here: https://github.com/EugenMayer/docker-sync/issues/683
here: https://github.com/EugenMayer/docker-sync/issues/679
In general your system cannot find ruby, or your system (with the current ruby version used) cannot find the docker-sync plugin. So you need to reinstall the plugin then.
This happened to me also after updating to Catalina. Fixed by running brew reinstall ruby and brew reinstall docker-sync.

Brew update failed on Yosemite

I upgraded my Mac to the new OSX 10.10.
brew update failed with:
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0
I tried to follow "Getting a "bad interpreter" error when using brew", but I couldn't get it working.
I do not have Ruby in /usr/local/bin or /user/bin, which may be for same reason which ruby returns nothing.
I have Xcode 5.1 with the command line tools installed. Whenever I start terminal I get:
-bash: /etc/profile.d/sm.sh: No such file or directory
-bash: /etc/profile.d/rvm.sh: No such file or directory
Can anyone suggest possible solutions?
First off upgrade Xcode to 6.1 This is the version that works with Yosemite.
After that make sure you RUN Xcode and Agree to the license ( i know it sucks ).
Note: After Updating My "Oh My Zsh" tools and restarting Xcode it installed some command line tools that I'm pretty sure are important.
There are things to note:
Mac OSX does come with a Ruby preinstalled in /bin/ruby. That is Apple's own installation, used for some of their tools, and basically should be ignored. Updating it could break those tools, and worse, deleting it, will break them. Trying to reinstall it is a pain, so it's better to pretend it isn't there.
We generally recommend using either RVM or rbenv to manage/install any other Ruby version. Those tools are well tested and make it easy to switch back and forth between versions.
rbenv is easier to manage but lacks some of the features of RVM.
Closely follow the RVM installation instructions if you go that way; We see a lot of questions on Stack Overflow caused by people who ignore the directions, or who follow directions on a different site besides RVM's home site. (The RVM authors really do know better than anyone else how to make it work.)
Brew can install Ruby, but switching between versions gets stickier.
It sounds like your PATH variable doesn't include /usr/bin, which is odd, because it should. If it did, it should find the default Ruby.
echo $PATH
will display your search path. It's editable and, if
ls /usr/bin/ruby
shows that Ruby does exist in /usr/bin then you should add it back into the path. You can do that by editing ~/.bashrc, but also check ~/.bash_profile to make sure something isn't messing up the path. And, if you don't understand how the path works, take the time to read about it, because a badly set-up PATH variable can slow your use of the command-line, or cause all sorts of weirdness.
By default there is no /usr/local/bin/ruby. It won't exist using RVM or rbenv either, but Homebrew will probably put a symlink; I don't have it supplying my Ruby, so I can't check that.

Cocoapods user-install: cannot run pod command

I have installed Cocoapods on OS X Mavericks using the --user-install option (to avoid having to use sudo for the installation) following the instructions at http://guides.cocoapods.org/using/getting-started.html#getting-started . I have also created a .profile file in my home directory with the following:
export GEM_HOME=$HOME/gems
export PATH=$GEM_HOME/bin:$PATH
Cocoapods successfully installs, but I am unable to run the pod command.
When running it from the command line it says No such file or directory. From what I understand, it should be installed into the /Users/me/gems/bin folder. However, this folder does not exist at all - the only Ruby related folder in my home directory is /Users/me/.gem.
I have tried running /Users/me/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/bin/pod but that results in the following error:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- bundler/setup (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from .gem/ruby/2.0.0/gems/cocoapods-0.29.0/bin/pod:14:in `<main>'
...but from what I understand, I shouldn't be running it from that location directly.
Any assistance for a Cocoapods newbie appreciated!
So after a lot of research and trying different things I have managed to get this working. I am not quite sure what eventually fixed the problem, or whether it was a combination of things, but for anyone else encountering this same problem here's what I did:
Installed the Xcode command line tools for Mavericks. The option to install this is no longer available in Xcode 5, so you need to download them from https://developer.apple.com/downloads . Some people seem to say they are already installed as part of Xcode 5 from the Mac App Store, whereas others say you need to manually install them. Either way, I figured that installing them again won't hurt.
The error message above talked about not being able to load bundler/setup. So, I (re?)installed the bundler ruby gem gem install bundler --user-install. Interestingly, when I then attempted to run the /Users/me/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/bin/pod command again I got a different error: /Users/me/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/Gemfile not found.
What was really handy is that after the installation of bundler a message appeared saying /Users/me/.gem/ruby/2.0.0/bin in your PATH, gem executables will not run. So, I checked out the contents of that folder and it contains the pod executable! Adding it to the PATH would certainly be handy, but I just ran it directly with the full path (after changing to my Xcode project folder containing the Podfile): /Users/me/.gem/ruby/2.0.0/bin/pod install and it all works!
When I ran pod install for the first time it showed a message saying Setting up CocoaPods master repo and stayed there for quite some time - I thought it had actually hung. However, it eventually completed. If you are unsure whether it is doing anything, or has hung, do ls -la ~/.cocoapods/repos/master/.git/objects/pack/ and look at the time modified/size of the file it is downloading (thanks to this comment for the hint).
Another tip for new players - when I tried to install a pod (in my case, BlocksKit) I got a message saying [!] The platform of the target Pods (iOS 4.3) is not compatible with BlocksKit (2.1.0) which has a minimum requirement of OS X 10.7 - iOS 5.0. This was a surprising message, since my project targets iOS 7.0. Apparently you don't need to specify the platform anymore, so I entirely removed the platform line from the Podfile and it all works.
Hope that this helps other people just getting started with CocoaPods!
After installing Mavericks, I got error with already installed cocoapods. So I ran this command to install the new updated cocoapods version, and it works now.
sudo gem install cocoapods
Thanks to the pointers in these answers, I found that the instructions for installing CocoaPods provided on the CocoaPods web site are incorrect, regarding the contents of the .profile file, specifically the path.
As Skoota noted in the question, the path $GEM_HOME/bin does not exist. A comment by Videre gives the important clue: the correct path is $GEM_HOME/ruby/2.0.0/bin.
The correct .profile contents, which works for me at least, is:
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/ruby/2.0.0/bin:$PATH
It is also worth noting that you must quit and relaunch the Terminal application for changes to the .profile file to take effect.
add:
export COCOAPODS_NO_BUNDLER=1
to your .zprofile or .bash_profile
FWIW - I ran into very similar problems. None of the above helped me so maybe others could benefit from my process.
Eventually just ran sudo gem uninstall cocoapods, deleting everything that I did before.
Followed the steps for creating the .profile file
For good measure, closed Terminal and rebooted everything.
Ran gem install cocoapods which somehow didn't run into errors this time
Checked the install by running gem which cocoapods which fortunately returned the correct path
ran pod setup which didn't raise any errors again .
Not entirely sure what actually worked and what didn't but maybe someone will find this useful.
I use homebrew to install cocapods
First install homebrew (paste this code in terminal and hit enter)
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Second enter this
$ brew install cocoapods

Warning! PATH is not properly set up, usually this is caused by shell initialization files

Whenever I go to a folder with a .rvmrc file, there is a warning:
Warning! PATH is not properly set up, '/home/me/.rvm/gems/ruby-2.0.0-p247/bin' is not available,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
to fix run: 'rvm use ruby-2.0.0-p247'.
I did rvm use ruby-2.0.0-p247, but the warning is still present.
Note: There are no errors, Im able to run my application just fine, but the warning is very annoying. Any ideas?
I was getting the same warning even after upgrading RVM to version 1.25.16. I was able to fix the warning by running:
rvm reset
Then when I ran:
rvm version
I did not receive the error anymore.
If you know what you're doing, and your PATH is set to what you want, you can suppress this message by putting the following in your ~/.rvmrc:
rvm_silence_path_mismatch_check_flag=1
This is handy if you use other path-manipulating programs like virtualenv, or if you just want to prefix your path with ~/bin or something.
I was able to get rid of this by doing
rvm get head
This was a bug and was handled with https://github.com/wayneeseguin/rvm/issues/2050 and was released as rvm stable 1.21.15 at 2013-07-29 19:15:30 -0700
I had the same problem too, and rvm get head didn't work for me, finally it was solved by running rvm get head --auto-dotfiles, then restarted the terminal and the annoying warning message disappeared! And the solution is found here: https://github.com/wayneeseguin/rvm/issues/2074
Hope this will help.
rvm get stable solved this for me
(as pointed out in comments on another answer by AndrewMarshall)
Okay, so I ran an export PATH command without realizing the implications and ran into the identical error, but I also lost all control of my typical commands like cd and pwd. I didn't want to reset the rvm tools I'd already installed per some of the answers above.
First attempt was to some sort of mac default path (found on google):
$ export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
Which actually solved my first problem of not having access to my typical command line tools, but was still getting the same error as #Santosh's initial problem. The next thing I did was navigate to my directory where I've set up rvm to start, and then to run a new export command as follows:
$ export PATH="$PATH"
This was how I initially set up rvm, and no more errors. Hope this helps someone
Make sure that you add the following at the end of your
~/.bash_profile OR ~/.zshrc file.
In this example our ruby version is ruby-2.6.1. Replace this with your ruby version.
export PATH=~/.rvm/gems/ruby-2.6.1/bin:$PATH
# RVM manual script for loading rvm to shell
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
This works for me.
Solved!
Warning! PATH is not properly set up, '/home/vaibhav/.rvm/gems/ruby-2.3.1/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-2.3.1'.
rvm get stable --auto-dotfiles
Next you might get below Error:
RVM is not a function, selecting rubies with ‘rvm use …’ will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Temporarily solution
I solved it temporarily by running source ~/.rvm/scripts/rvm it is the only solution it worked for me. but you have to run it every time you close the terminal. at least solves your emergency

RVM causing path issues with installed gems on Ruby 1.9.2 - unable to annotate, etc, do I need to reinstall RVM?

I'm on Mac OSX Snow Leopard. I tried to post a similar question to the RVM Google group but it did not seem to get posted.
I'm worried that I've done something fundamentally wrong with my RVM install that's causing these errors, that seems to be related to paths, at each step of the way. Have any of you seen this behavior before?
I started to teach myself Rails programming as of about two months ago with a working environment of Ruby 1.9.1 and Rails 3.0.3, based on a hivelogic install tutorial that had me modify my ~/.profile file and install the relevant bits to ~/usr/local/src/. For reference, the line in my ~/.profile file was this when I installed RVM, if that makes any difference:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/src:$PATH"
In my terminal I installed RVM as a user using the standard user github bash script.
I tried to install Ruby 1.9.2, which kept running into a weird error about a libfile somewhere. After much Googling I found someone on Stack Overflow that recommended renaming the ~/usr/local directory while performing the Ruby install -- I did this, and the install complete.
Then I did gem install rails and tried to do bundle install in my app, which gave an error when trying to install the SQLite3 gem (even though I already had SQLite3 installed and working). Again, I spent a day Googling this and eventually found "Unable to install sqlite3-ruby gem" that said if I used Macports to sudo port install sqlite3 it would work.
I tried that from the base directory, and Macports did its thing but it didn't fix the problem. Then I did the same thing from my app directory and it fixed the SQLite3 error I was getting.
Now I am able to run rails server and rails generate again, which is great, but then I tried to "annotate" my new model, and I get this error: http://pastie.org/1481570
I have not yet solved this issue, and have looked at many threads of similar issues. This, for example, did not solve my problem: https://github.com/james2m/annotate_models/commit/5997da9692c9b222e8d1be22dfad6ed8638c16a1
I even tried copying my source code directly into the rvm/user/ directory in case that relative path was causing problems, but it doesn't seem to have fixed anything. Maybe I need to uninstall RVM and re-install it as root instead of a user-level thing?
What do you think is the best way to get annotate to work and hopefully get RVM to play nice with my gems going forward?
I'm unfortunately REALLY new to terminal, code, etc, so any help would be much appreciated.
On Snow Leopard you should modify either ~/.bashrc or ~/.bash_profile, preferably the later. Also, RVM will not need anything in ~/usr/local since it's entirely self-contained in ~/.rvm.
RVM uses a nice little shell function to sense the needed directories and desired default Ruby. I suspect either the instructions you followed were very out of date, or poor recommendations. The current RVM installation requests you add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
to your ~/.bash_profile
The RVM site has lots of troubleshooting tips for things like MySQL. I'd strongly recommend backing out of the things those other tutorials had you do, and refer to the instructions on RVM's site. It is very easy to get things working right if you do it the RVM-way.
Download and install Apple's latest version of XCode from their Developer site if you haven't already. There have been some broken versions shipped on the DVDs.
Install. In particular follow the "Post Installation" section.
Following that, do whatever rvm notes says to do as far as libraries. Following that, you should be able to use rvm info to gather useful info about your installation. It is your best friend.
Database integration will point you to how to fix MySQL's wagon.
RVM development happens fast. Keep it updated, at least once a week using rvm get head.
At that point you should be in a good place to start reinstalling gems.

Resources