I'm trying to do the One Month Rails program. After doing some research on some warnings, I damaged my Ruby and Rails installation. I uninstalled RVM, Ruby and Rails and messed up everything.
Opening a new terminal directly gives me:
Last login: Wed Aug 21 23:04:17 on ttys001
-bash: /Users/marcboehle/.rvm/scripts/rvm: No such file or directory
I tried to uninstall RVM, and everything else and wanted to start from scratch but with every new installation of RVM, Ruby and Rails it leads to the same errors.
The next thing is:
Upgrading the RVM installation in /usr/local/rvm/
Can not automatically remove lines with 'rvm_autolibs_flag=' from '/etc/rvmrc', please clean it manually.
Found 4800 directories with mode different then '775', use `--debug` to see the list, prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Found 18220 files with mode different then '664' or '775', use `--debug` to see the list, prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Upgrade of RVM in /usr/local/rvm/ is complete.
lab037:~ username$ rvm install
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-1.9.2-p320/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.2-p320'.
Can not use or install 'all' rubies.
Is there a good way to get rid of everything that's connected to Ruby, Rails and RVM and start from the beginning with a fresh installation? I can't figure out where /etc/rvmrc is.
The shell problems that you're having come from /Users/marcboehle/.profile or /Users/marcboehle/.bash_profile. Those will contain the directives for RVM. For example here's mine:
brambook-pro-2:~ bram$ more ~/.bash_profile
export PATH=/Users/bram/.rvm/bin:/usr/local/mysql/bin:$PATH
$HOME/.rvm/scripts/rvm
You'll want to remove the PATH items that contain RVM, then follow the installation instructions and see what you get.
Related
When I create a scaffold in terminal, I get the above error message. I have type the following command first:
echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bashrc
I still get the following error:
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
Any help will be greatly appreciated.
Try running the command source ~/.bashrc and then re-running rails. If that doesn't work, a different approach may be needed.
The problem is that as far as your OS is concerned, Rails doesn't exist. There could be multiple reasons for this. Seeing that you're using rvm, rvm is supposed to tell Ubuntu where to find rails.
Make sure that you are using the correct version of ruby specified in your Gemfile by typing rvm current. Make sure you are using the correct version when running bundle install, otherwise the gems will be installed under a different ruby version.
Also, make sure that the ~/.rvm directory exists and that the path specified in your .bashrc file is correct.
Let me know if any of these suggestions help.
I am doing the Ruby on Rails 4 essential training with Kevin Skoglund. I installed Xcode and Homebrew no problems, was following along just fine when I went to do the command rbenv global 2.3.0 to change to the newest version, it won't do it. I was instructed to logout and back in, i shut down and restarted and I am still in version 2.0. How do I get it to change? I am a super noob, but I am brave. I would love to figure this out so i can get started.Also, i went to update my gems and this happened,
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
So I was stopped dead in my tracks, any help will be much appreciated
It's probably the case you missed a step on the rbenv installation. Unless the stub is installed in your .bash_profile (or equivalent), then rbenv won't engage on your shells properly.
Try repeating step two on the Basic GitHub Checkout step:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
Then check that it's installed correctly:
type rbenv
Which should be a function.
What you're describing is probably a $PATH issue where the system Ruby is taking priority. The rbenv one needs to come first.
When I execute the command:
rails s in my project, the console display the message:
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
I executed the command:
brew upgrade rbenv ruby-build
rbenv install --list
and the version 2.1.2 appears in the list.
Then, I executed the command: rbenv rehash, but appears the same message when I executed the command:
rails s.
In my Gemfile file, is listed the:
ruby '2.1.2'
but I'm not looking replace this value with the previous version.
And if I execute :
rvm use 2.1.2
Is displayed:
Warning! PATH is not properly set up,
'/Users/Jarvis/.rvm/gems/ruby-2.1.2/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.1.2'. Using /Users/Jarvis/.rvm/gems/ruby-2.1.2 Warning!
Executable 'ruby' missing, something went wrong with this ruby
installation! Warning! Executable 'gem' missing, something went wrong
with this ruby installation! Warning! Executable 'irb' missing,
something went wrong with this ruby installation!
What I'm doing wrong?
RVM and RBenv are actually similar tools. There are no practical reasons to keep them alongside each other in one session (and on one machine most of the time). They both rely on modifying PATH environment variable to get the Ruby and supplementary binaries closer for easy use.
And that's what RVM complains about: PATH is not what it expects to be. That said, RBEnv apparently tampered with it. Since these tools do their best to overtake ruby, gem, irb and stuff, they may very well conflict with each other on occasions.
So, remove one of them. Which one, is up to you. Removing RVM is as easy as:
rvm implode
...that will remove RVM's files, rubies and gems for them, but you might also want to inspect .bash_profile, .profile and .bashrc for relevant lines.
The uninstallation process for RBEnv seems to be the manual one: remove the folder, review the files listed above for relevant lines.
I have been learning Ruby on Rails for a couple of months, and everything was working.
Then, for the needs of a tutorial, I tried to install RVM, in order to downgrade my setup to older versions of Ruby and Rails.
And since then, I kept running into troubles.
For instance, anytime I launch a new Terminal session, here is what I get:
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /Users/Thibaud/work/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
ree-1.8.7-2012.02 - #gemset created /Users/Thibaud/.rvm/gems/ree-1.8.7-2012.02#tedxperth
ree-1.8.7-2012.02 - #generating tedxperth wrappers....................
Using /Users/Thibaud/.rvm/gems/ree-1.8.7-2012.02 with gemset tedxperth
Warning! Executable 'ruby' missing, something went wrong with this ruby installation!
Warning! Executable 'gem' missing, something went wrong with this ruby installation!
Warning! Executable 'irb' missing, something went wrong with this ruby installation!
Two questions:
How can I resolve the errors appearing in my Terminal? (see above)
Since I do not know what got broken in my install, I am wondering whether I should unsintall the whole Ruby on Rails environment and set it up again to get a clean install: Is this a good idea? If so, how can it be achieved?
Your first set of errors will go away if your remove the hidden .rvmrc file in your project directory:
$ rm .rvmrc
The file only exists to set a Ruby version and gemset when you cd into the directory. You can either set the Ruby version and gemset manually, or create new .ruby-version and .ruby-gemset files which are compatible with RVM and other version managers. For details, see my answer Use rvmrc or ruby-version file to set a project gemset with RVM?.
You may need to remove and reinstall the Ruby version you are using. Here's how:
$ rvm remove ree-1.8.7-2012.02
Here's the documentation.
You probably don't need to uninstall RVM. But if you do, you can use
$ rvm implode
to remove all traces of RVM before re-installing (documented here). For more details on installing Ruby and multiple versions of Rails using RVM, see the article I wrote:
Install Ruby on Rails - Mac OS
X
Lastly, since you mention that you are reading a tutorial that requires an old version of Rails, may I politely suggest you have a look at a book I've written for beginners that is up to date with the newest version of Rails (currently Rails 4.1 but I revise the book with every new release). I hope it is helpful:
Learn Ruby on
Rails
I mention my article and my book because they provide additional information about setting your development environment for Rails using RVM and may answer further questions for you.
So I was following the steps on Hivelogic to get ruby on rails setup on my machine. After compiling and installing, I used the which ruby command to double check it installed in the right place. It did not. I was able to install the Rails and MySQL gems though, but both POW and localhost:3000 don't work.
Is there anything wrong with having it in the usr/bin directory instead of usr/local/bin? My usr/local/bin is practically empty, but usr/bin has a ton of files in it.
Edit: I reinstalled ruby to usr/local/bin but now Rails won't install. Is it a problem that it's already installed in usr/bin?
That page is a few years old. The current best practice for Mac and Linux is to use rvm. You can see, even Hivelogic uses rvm now (though I'm not sure how I feel about installing it system wide).
Anything that recommends installing from source as the first option instead of a last-resort fallback is probably bad advice. It's better to install using a package manager like MacPorts or Homebrew both of which have current versions of Ruby 1.8 and 1.9.
MacPorts installs everything in /opt specifically to avoid conflict with system files. From time to time Apple will distribute an update that patches ruby and this can mess up anything you have in the way of dependencies if you've been using a modified /usr/bin/ruby. Generally the system ruby is supposed to be left as-is.
You can replace the "compile ruby" step with an installer like that and save yourself a lot of trouble in the future. Just be sure to have /opt/local/bin as one of the first items in your PATH just as you would for other solutions.
Since installing Ruby and Rails and some kind of database can be a confusing process, it seems like there should be a meta-installer to help you through the process.
So I finally managed to get rails installed in the correct spot. I had to change the line in my .profile to export PATH="/usr/local/bin:$PATH" and then do a sudo gem update --system after installing rubygems before rails could actually be installed.
RVM and Homebrew did not help at all.
EDIT: Since people have a problem with this answer, I'm giving an update. I have since installed RVM and am liking it, but only because I have a friend I ask all my questions to, as RVM is really confusing if you're not used to doing a lot on the command line. I needed help from him to install it because I didn't have any of the bash files, and thought they were hiding somewhere. If you're missing the bash files, just create them yourself. This took a long time to get working, but now I apparently have it setup right.