I'm trying to install Rails onto my Mac and keep running into a this issue. I have no coding/programming experience and am trying to get set up so I can start learning.
I have gone through everything on install rails.com and am not sure what to do.
Your help is appreciated.
make install failed, exit code 2
Gem files will remain installed in /Users/feferrada/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/feferrada/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out
Follow the steps below to install ruby on rails on mac osx yosemite.
If that does not work please post the exact errors.
For further details about the installation have a look at https://gorails.com/setup/osx/10.10-yosemite
Installing Homebrew
You might be asked to install the XCode CommandLine Tools - say yes.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing Ruby
you can browse the available versions using
rbenv install --list
installation using homebrew
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.2.1
rbenv global 2.2.1
now ruby is installed and you should be able to run
ruby -v
# ruby 2.2.1...
Installing Rails
you can browse the available versions of rails using
gem list ^rails$ --remove --all
installation
gem install rails -v 4.2.1
to use the rails command run
rbenv rehash
now rails is installed and you should be able run
rails -v
# Rails 4.2.1
Related
To start I follow the exact steps from Setup Ruby On Rails on
macOS 10.13 High Sierra, just like I have with every other version of mac/ubuntu.
So basically install homebrew, install rbenv ruby-build
add the following to bash profile and source it:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
then do
rbenv install 2.5.1
rbenv global 2.5.1
ruby -v
outputs:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
do a which ruby to to make sure:
/Users/pdavies/.rbenv/shims/ruby
run gem install
gem install rails -v 5.2.0
which outputs:
Successfully installed rails-5.2.0
Parsing documentation for rails-5.2.0
Done installing documentation for rails after 0 seconds
1 gem installed
then a rehash and check version:
rbenv rehash
rails -v
outputs:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
found anther issue that suggested adding:
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"
to the bash profile, did that sourced it and tried again still nothing. to check the output of echo $PATH was:
/Users/pdavies/.rbenv/shims:/Users/pdavies/.rbenv/bin:/Users/pdavies/.rbenv/shims:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
Just to make sure i also did which gem incase i wasnt using the right one, output:
/Users/pdavies/.rbenv/shims/gem
when I do a which rails i get:
/usr/bin/rails
I found some blog that said to delete that, but I cant seem to do that either, i just get:
sudo rm -f /usr/bin/rails
Password:
rm: /usr/bin/rails: Operation not permitted
This is a fresh install of OSX and the only way I can get it work is to downgrade the version of OSX that is installed, which is a pain in the ass!
Any help would be grateful
Thanks
I receive the following error when attempting to do string.encode("UTF-8") with a non-ascii character.
LoadError: dlopen(enc/trans/single_byte.so, 9): image not found - enc/trans/single_byte.so
Unlike the answer here, it appears that this file does not exist in my ruby install, or anywhere else on the system for that matter. I'm running ruby 2.1.7 and bundler 1.10.6, running on Mac OSX 10.11.5. I tried reinstalling ruby (using RVM) with no success.
Should this file exist, and if so what do I need to install?
I would suggest trying to install it using chruby + ruby-install. You can use ruby-install to install any Ruby version you would like, and chruby is a small utility for switching between Ruby versions.
I've seen RVM have issues occasionally, and re-installing Ruby with ruby-install seemingly fixes the issues.
I have a guide for that here: http://ryanbigg.com/2015/06/mac-os-x-ruby-ruby-install-chruby-and-you/
Here's the steps in condensed form:
# Installs XCode development tools package
xcode-select --install
# Installs Homebrew (skip if you've done this already)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install chruby ruby-install
ruby-install -V # this should show ruby-install: 0.6.0
ruby-install ruby 2.1.7
Add this line to ~/.bashrc:
source /usr/local/opt/chruby/share/chruby/auto.sh
Reload ~/.bashrc:
. ~/.bashrc
Running chruby should now show you ruby-2.1.7 and running ruby -v should show you 2.1.7 too.
Am trying to set up rails on mac using rbenv and Homebrew.
Currently getting the following message when attempting to 'gem install rails':
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
username-mbp:projects username$ gem install rails
Any ideas??
If you are using rbenv, you should not use sudo to install gems. rbenv very helpfully installs your gems under your home directory in a way that allows you to use different gems for each installed Ruby version. When you change versions of Ruby you will really appreciate this.
To see the current version of Ruby, use rbenv local. For me this prints:
2.2.2
To see all the Ruby versions on your system of which rbenv is aware:
rbenv versions
rbenv stores the version specifier in a file called .ruby-version. This allows you to use different versions of Ruby for different projects, each version having its own set of gems.
When you try to install rails and get the Gem::FilePermissionError, it means that rbenv is not active, or you are deliberately installing into the "system" Ruby. There is nothing wrong with this per se, but you are not taking advantage of rbenv.
I recommend installing Rails again, using rbenv local to ensure that you are adding the gems to the correct path. You'll know this is working when
gem env gemdir
produces something like:
/Users/username/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
See https://github.com/sstephenson/rbenv#installation for more info.
This probably means that you used sudoat some point, which means that you run a command that allows you (as a permitted user to execute a command as the superuser or another user) See here: http://linux.about.com/od/commands/l/blcmdl8_sudo.htm.
Can you please paste the commands you used for installing rbenv, ruby, gem, brew, etc.? Also please paste the output of brew doctorto see if environment is correctly configured for Homebrew. Also, please paste the OSX version and rbenv versionsif rbenv is installed.
The steps for installing ruby on rails on OSX are:
Install Homebrew by:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`` (as seen here: http://brew.sh/). Run brew doctor and brew updateto see if everything is fine.
Install ruby: OS X comes with Ruby installed (Mavericks/Yosemite even gets version 2.0.0, previously it was only 1.8.7).
Install rbenv: it can be done either by GitHub Checkout or Brew. You probably should use brew. Run brew install rbenv ruby-build(this will also install ruby-build -https://github.com/sstephenson/ruby-build#readme-). You can also use this command brew install rbenv ruby-build rbenv-gem-rehash. Then echo 'eval "$(rbenv init -)"' >> ~/.bash_profile (to enable shims and autocompletion). You should problably run this too: echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile. Close terminal and open it again. Install the preferred version of ruby (if you want): rbenv install 2.0.0-p353.
Install Bundler: gem install bundler.
Install SQLite: gem install sqlite3
Install Rails: gem install rails.
So, the error you are having is due to permissions (you can understand about them here: http://www.tutorialspoint.com/unix/unix-file-permission.htm). Many people suggest fixing the issue with sudo or chown (http://www.cyberciti.biz/faq/how-to-use-chmod-and-chown-command/). I don't recommend that as it messes with system configuration. It will be better that you run:
rbenv install 2.1.2
rbenv global 2.1.2
gem update --system
When I run with this error like a year ago, what I did was uninstall everything and start again... but, probably that'll take too long.
These links might help you:
ruby for mac, ruby rbenv, rbenv githube, rubies and gems, question on stack
Use sudo:
sudo gem install rails
This guide helped me a lot: Setup Ruby On Rails on
Mac OS X 10.10 Yosemite
I am setting up my new machine (Mac Yosemite) and when I run the command "bundle" I get the following error:
Your Ruby version is 2.2.1, but your Gemfile specified 2.2.0
I'm trying to change the version w Rbenv but I think it's not working.
ruby -v
// Ruby 2.2.1p85
rbenv version
// 2.2.0
Can anyone help me? Thanks in advance!
Try to use rbenv local [version number].Refer to this for more understanding.
I had a similar problem but with ruby -v 2.2.0 and Mac OSX El Capitan. What finally worked for me was:
gem install bundler (apparently it was no longer installed)
rbenv rehash
bundle install
I was able to find the answer on the github for rbenv.
https://github.com/sstephenson/rbenv/issues/697
Assuming you have Ruby -v 2.2.0 installed (rbenv install 2.2.0 otherwise), change your ruby version with rbenv:
rbenv global 2.2.0
after install rails you must do this: rbenv rehash, in order to tell rbenv to see rails as executable.
follow this tutorial to set up Ruby and Ruby on Rails in your machine: https://gorails.com/setup/osx/10.10-yosemite
Note: In my case. after install rbenv the command rbenv global 2.2.0 doesn't affect my current ruby version (ruby -v still be the previous one). I fix this issue reinstalling rbenv and run this command:
# 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
immediately afterwards, as explained above in the tutorial.
I'm trying to get ruby 2.1.4 installed via rbenv for a client project.
Though previously I've been able to install ruby versions through rbenv, after upgrading to Yosemite, I keep getting the following error:
rbenv: no such command 'install'
After digging around, I saw lots of tips about how "install" comes from the ruby-build plugin, which is installed via homebrew:
which ruby-build
/usr/local/bin/ruby-build
I installed rbenv via Homebrew, but when I try use which rbenv, I get:
rbenv () {
typeset command
command="$1"
if [ "$#" -gt 0 ]
then
shift
fi
case "$command" in
(rehash|shell) eval `rbenv "sh-$command" "$#"` ;;
(*) command rbenv "$command" "$#" ;;
esac
}
I have run brew update and brew upgrade rbenv ruby-builder, and it tells me everything is up to date.
Below is my full $PATH:
zsh: no such file or directory: /usr/local/var/rbenv/shims:/usr/local/var/rbenv/shims:/usr/local/bin:/usr/local/sbin:/Users/dannycox/.rbenv/shims:/Users/dannycox/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/Users/dannycox/.rbenv/shims:/Users/dannycox/.rbenv/bin
UPDATE: Found another answer with a little deeper digging on github that showed signs of promise, but failed to solve the issue with rbenv. https://github.com/sstephenson/rbenv/issues/610#issuecomment-56240018
I believe 2.1.4 is now installed on my machine, but it installed here:
Successfully installed ruby 2.1.4 into /Users/dannycox/.rubies/ruby-2.1.4
As a result, my bundler won't work with the new ruby 2.0 version and I get the following error when I try to gem install bundle:
Fetching: bundler-1.7.6.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory
Still need help to identify why ruby-build isn't playing nice with rbenv...
Make sure to install optional step 5 in the instructions:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Install ruby-build, which provides the rbenv install command that simplifies the process of installing new Ruby versions.
I had similar problem, and trace the problem to ruby-build. So i updated the homebrew and reinstall the ruby-build
> brew update
> brew reinstall ruby-build
Find the ruby version
> brew ls -v ruby-build | grep 2.1.4
then install intended version ruby again
> rbenv install 2.1.4
From your perms error I think you are trying to install to the system ruby, which is the one that comes with Apple OSX. You want to use rbenv to install your own ruby and install gems into that.
Read - https://github.com/rbenv/ruby-build#readme
And use the
rbenv versions
command to show what instance of ruby you are about to install the gems into. If it's system then you need to install your own ruby instance and then use that ruby for gems.