I cannot install ruby new version. I stall the home-brew and ruby-build, both install successful. I type $ rbenv, it shows
...
install Install a Ruby version using ruby-build
...
then i stall version 2.3.1
$ rbenv install 2.3.1
it shows error
Zhimings-MacBook-Pro:~ zhimingjiang$ rbenv install 2.3.1
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
mkdir: /usr/local/var/rbenv/versions/2.3.1/lib: Permission denied
BUILD FAILED (OS X 10.11.5 using ruby-build 20160426)
Inspect or clean up the working tree at /var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035
Results logged to /var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035.log
Last 10 log lines:
/var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035 ~
/var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035/ruby-2.3.1 /var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035 ~
I does't have path /usr/local/var/rbenv, I only have path /usr/local/rbenv
Additions (here is the tutorial i have watched
https://www.youtube.com/watch?v=jx0NrIbQbzI)
You can try install ruby via rbenv following as this tutorial:
I tried it and success.
install rbenv on osx
Update:
You should do these steps as below:
brew install rbenv
brew install ruby-build
echo 'export RBENV_ROOT=/usr/local/var/rbenv' >> ~/.bash_profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
Then you used rbenv to install ruby. First, find the desired version:
rbenv install -l
And rbenv install 2.3.1
I find out
https://www.ruby-lang.org/en/documentation/installation/
search key words "Building from Source"
follow the instruction
download -> unzip -> terminal cd into folder -> star to type those 3 line commend.
also if install other which require ruby. You may still need to type $./configure --with-openssl-dir=/usr/local/ssl
Related
I am new to programming and trying to install Rails on Ubuntu 18.10, but I get the following error when running ~$ gem install rails. How do I avoid this error and install rails?
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # dir_s_mkdir - /home/bernardo/.gem/specs
I'm running Ruby 2.5.3p105.
Here are the steps that I took to install rbenv in ubuntu server
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv -v
rbenv install 2.5.3
rbenv global 2.5.3
rbenv rehash
ruby -v
gem install bundler
# inside rails application
bundle install
Explanation:
Line 1: clone rbenv project
line 2-4: enter rbenv path and settings to your bashrc
rbenv -v = check whether your rbenv is running correctly
then install ruby version (I checked above you running version 2.5.3)
rbenv global 2.5.3 (set version 2.5.3 in any folder paths)
rbenv rehash (after you set global / local make sure you do rehash)
Just go through the steps given in below link: https://gorails.com/setup/ubuntu/16.04
and make sure you install ruby using rvm and set is default ruby. Then install rails.
This will resolve your issue.
If still the problem is not resolved, then remove previously installed ruby and go through all the steps for ruby and rails installation.
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
Use sudo gem install rails May helps you.
lots of instructions online show that we need to install Ruby on Rails on linux. Can we actually install it on Mac? Because Ubuntu is too slow on Mac so far, I wanna change to Mac itself instead of using a virtual machine.
Sure, we can use MacOS for development, and Linux for production.
Yep. It's simple. Open Terminal and follow this steps:
Install Homebrew:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Upgrade ruby version:
$ brew install rbenv ruby-build
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile
$ rbenv install 2.5.0
$ rbenv global 2.5.0
Install last rails version:
$ gem install rails -v 5.1.4
$ rbenv rehash
I am learning to code and trying to make the move for a Rails project from a cloud dev environment to a local one on my Mac with OS Sierra. However, I am having trouble setting up my ruby version and installing rails.
I have installed Homebrew which I used to install rbenv. Using rbenv I have installed ruby 2.4.0 and set it to local and global. I can see it in .rbenv/versions, however when I check my ruby version I still get 2.0.0
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
When I try and install Rails I get the following;
$ gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
I am not sure how I utilize the rbenv ruby version in my system to then install rails.
You probably need to add rbenv to your ~/.bash_profile:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Then source it:
source ~/.bash_profile
Then you can use the rbenv command:
# install a Ruby version:
$ rbenv install <version>
# show versions currently installed and indicate current version
$ rbenv versions
# set ruby version for a specific dir
$ rbenv local <version>
# set ruby version globally
$ rbenv global <version>
# list all available versions:
$ rbenv install -l
The rbenv command is used to install, switch between versions, etc.
I'm on MacOS Sierra
brew doctor says no problem
xcode/gcc is installed
My first problem is no response when I use curl.
And here is what I get when I trace the installation.
After the installation is complete, I restart my terminal and try and use 'source ~/.rvm/scripts/rvm', but I get an error 'No such file or directory'
I've tried to delete the directory and re-install a couple of times, but no luck.
EDIT: If I don't use -sSL, I get two lines of output, but still no luck: imgur.com/a/bxyLy
EDIT2: https://github.com/rvm/rvm/issues/3910 allows installation
Use rbenv instead of rvm, rbenv is most suitable than rvm.
Homebrew setup:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
rbenv setup:
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.4.0
rbenv global 2.4.0
ruby -v
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.