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
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 installed rvm ruby and gem.
When I used gem to install rails, it's like this:
woyuxuxu123#ubuntu:~$ sudo gem install rails
[sudo] password for woyuxuxu123:
Successfully installed rails-5.1.4
Parsing documentation for rails-5.1.4
Done installing documentation for rails after 0 seconds
1 gem installed
But when I enter rails -v, I got:
woyuxuxu123#ubuntu:~$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
I tried some solutions, but did not work for me, such as
source ~/.rvm/scripts/rvm
Someone mentioned the path. Here is how it looks
RubyGems Environment:
EXECUTABLE DIRECTORY: /usr/local/bin
woyuxuxu123#ubuntu:~$ echo $PATH
/home/woyuxuxu123/bin:/home/woyuxuxu123/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/woyuxuxu123/.rvm/bin:/home/woyuxuxu123/.rvm/bin
What should I do?
I faced a similar issue for Rails 5.2 and Ubuntu 18.04. I had an already setup server with Ruby and Rails installed, but I couldn't access them.
The error output was:
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
The issue is simply caused by the rails executable not being globally accessible by programs.
Here's how I solved it
Note: If you are working on a production server, endeavour to make a backup of your database before trying out the solution below to avoid data loss.
For my case, my version manager was rbenv and not rvm
Re-install rbenv itself. Clone the rbenv repository from GitHub into the directory ~/.rbenv:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Next, add ~/.rbenv/bin to your $PATH so that you can use the rbenv command line utility. Do this by altering your ~/.bashrc file so that it affects future login sessions:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Then add the command eval "$(rbenv init -)" to your ~/.bashrc file so rbenv loads automatically:
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Next, apply the changes you made to your ~/.bashrc file to your current shell session:
source ~/.bashrc
Verify that rbenv is set up properly by using the type command, which will display more information about the rbenv command:
type rbenv
Your terminal window will 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
}
If everything worked right, running the command below will display the versions of Ruby and Rails previously installed on your machine:
ruby -v
rails -v
Else, run a fresh installation of Ruby and Rails on your machine.
That's all
I hope this helps
Probably you forgot to add rvm script to your .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Try running rvm repair all and then restart your terminal.
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
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