Trouble installing Homebrew - ruby-on-rails

I have just started learning Ruby on Rails and am having a little trouble getting the environment set up on a Macbook Air OS X version 10.9.3
I installed Ruby from rvm.io
I have:
Ruby 2.0.0p451
Rails 4.1.4
Git 1.7.4.4
XCode version 2003 (is this wrong?)
I used ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
but I get back Failed during: /usr/bin/sudo /usr/bin/xcode-select --install
I looked around and I have seen that people suggest Homebrew not be installed using sudo access, but it keeps asking for my password. What am I doing wrong here? Why does Homebrew refuse to install?

What is the exact version of XCode? 5.1.1? The failed command is to install XCode command line tool. Probably you can install that first before installing Ruby.

Related

Issue with install xcode while installing ruby, rails and postgresql on macOS Big Sur 11.2.3

UPDATES
I'm having some issues on a new mac m1 and my install of ruby, rails, xcode and postgresql
First attempt:
##What I did ?
Installing homebrew, ruby, rails, postgresql
OS: macOS Big Sur Version 11.2.1 (20D74)
zsh: 5.8 (x86_64-apple-darwin20.0)
postgres: 13.2
Rails version: Rails 6.1.3
Ruby version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
Brew version: Homebrew 3.0.9
What I could do:
I have successfully:
create a rails app with rails new myApp -d postgresql
add gem devise to the Gemfile
run bundle install
create devise User and all CRUD views
run db:create, db:migrate
launch the server with rails s
access all the pages of login, sign up, etc...
Expected behavior
I'm expecting to be able to create an account and connect to it on the app.
Actual behavior
When I try to create an account I'm running into an error about the gem bcrypt that seems to run on the wrong architecture...
Second attempt:
I've uninstall ruby, rails, rbenv, postgresql, homebrew
I've update my OS version to: macOS Big Sur 11.2.3
I'm following this tutorial:
gorails.com/setup/osx/11.0-big-sur
Brew version: Homebrew 3.0.11
rbenv version: rbenv 1.1.2
ruby versions:
2.7.2 (set by /Users/lucas-illiano/.ruby-version)
3.0.0 (I can't put the 3.0.0 version to global...)
rails version: 6.1.1
I've deleted rbenv before deleting all ruby versions on the system ? Is that why ?
At the end of the tutorial, before installing postgresql, it says to install this package macOS_SDK_headers_for_macOS_10.14.pkg
But I'm running into an issue about x-code and CommandLineTools install.
I've tried to download the package from here developer.apple.com/download/more I cannot get the folder /Library/Developer/CommandLineTools/
I've also tried xcode-select --install but x-code is already well install. No upgrade available.
I can't think of any other way to install successfully this package.
Anyone have an idea about the issue installing xcode and CommandLineTools on MacOS Big Sur?
Thanks by advance and have a good day to you all.
Not sure if this will help you. If you were able to run the server then xcode, and other things are probably good already.
I am not much into Ruby/Rails now but from what I understand. Some gems are not supported for Apple M1 arch yet. If you're getting an error similar to missing compatible arch then using arch -arch x86_64 before the command may help.
In my case, where I was running another gem - Jekyll, using arch -arch x86_64 solved my problem.
> bundle exec jekyll build --> failed with arch error
But,
> arch -arch x86_64 bundle exec jekyll build --> works just fine

Issues with installing Ruby 2.0.0 on macOS Catalina

I'm running to issue installing Ruby 2.0.0 on a new macbook with macOS Catalina (version 10.15.7). At first I installed Ruby with rvm which did not work. I figured out that it was because Catalina's default terminal is ZSH instead of Bash (https://gorails.com/setup/osx/10.15-catalina). I was able to install Ruby 2.6.3 with the instructions but the issue is that the project I'm currently working on was written in Ruby 2.0.0. I tried installing this version with rbenv install 2.0.0-p0 but I ran to the following errors:
ruby-build: using libyaml from homebrew
Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/vydoan/.rbenv/versions/2.0.0-p0
Downloading ruby-2.0.0-p0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.bz2
Installing ruby-2.0.0-p0...
WARNING: ruby-2.0.0-p0 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/m4/3k5xfdwx7x7gqkzzlyrlc_gc0000gn/T/ruby-build.20201006082731.4615.0q3Cat
Results logged to /var/folders/m4/3k5xfdwx7x7gqkzzlyrlc_gc0000gn/T/ruby-build.20201006082731.4615.log
Last 10 log lines:
compiling cont.c
compiling ./enc/ascii.c
thread.c:928:27: error: implicit conversion loses integer precision: 'long' to '__darwin_suseconds_t' (aka 'int') [-Werror,-Wshorten-64-to-32]
tp->tv_usec = ts.tv_nsec / 1000;
~ ~~~~~~~~~~~^~~~~~
compiling ./enc/us_ascii.c
1 error generated.
make: *** [thread.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
I've tried doing the follow:
1.
brew tap homebrew/dupes
which gives me this error log
Error: homebrew/dupes was deprecated. This tap is now empty and all its contents were either deleted or migrated.
brew install gcc
rbenv install 2.0.0-p0
which gives me the same errors as above.
I've asked my team and found that another person also have issue with installing ruby on their new mac machines. The older mac didn't not have this problem. Was anyone able to successfully install Ruby 2.0.0 on the newer mac?
Hello I had numerous issues trying to install ruby 2.2.7 the project I work on has quiet a deprecated version of ruby necessary stated above now I ran into numerous problems they use rvm I could not install 2.2.7 using rvm I have however succeeded using rbenv the thing that ruins your experience is mainly the command line tools provided by Apple since in newer version it does not support compiling older ruby versions.
I also run the same version of MacOS :
Your best bet (since I've tried several days in a row to get my setup working installing ruby being the biggest blocker).Go to apple's developer site and download an older version of command line tools here and browse for 11.4.1(Before running the next steps make sure to purge previous attempts and ruby version managers and symlinks so it won't interfere with you next install and make your life hard).
Before downloading and installing it check your gcc -v remember that and install the command line tools you've downloaded and check it again to see if things went according to plan you should get something like:
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I haven't tried other versions but this one works afterwards go to rbenv official website install the tools add the shell scripts to your local .zshrc file (if you don't have one just create it).Besides adding what the guide says it ommits an important step you also need to add this to your .zshrc:
export PATH="$HOME/.rbenv/bin:$PATH"
Then you should just close and open the terminal and install the ruby version you need :
# list latest stable versions:
$ rbenv install -l
# list all local versions:
$ rbenv install -L
# install a Ruby version:
$ rbenv install 2.0.0-p247
Consult the docs as of how to use them globally or locally also if use is not working end all terminal windows and the process restart and it should work just okay.
!Important mentions is to not change the command line tools when compiling different ruby related version may break the setup (ignore brew messages to update command line tools when running brew doctor)!

Uninstall Ruby, rbenv and homebrew and reinstall Ruby on Rails with RVM on MAC

I'm very new to RoR specially on Mac. I have installed it many times on Ubuntu with RVM and I'm very comfortable with that. Here is what happened on Mac:
I went through instructions as explained here http://goo.gl/zsHcCC then when I got to the point to install Rails with " gem install rails " I got this error:
Error installing rails:
ERROR: Failed to build gem native extension.
Now I want to roll-back everything and uninstall rbenv and it's ruby versions and reinstall the Ruby On Rails environment using RVM.
I tried to find how to uninstall Homebrew, RBENV and Ruby, but no success.
Thank you.
Sia
Homebrew or Rbenv are very good tools to have as a dev, I would think twice before removing either.
In this case I doubt they are at fault.
Can you confirm you have installed the GCC command line utils for OSX by running $ xcode-select --install in your terminal.
Here is a useful post explaining that process but I find that command generally works fine for me.
If this succeeds what does your $ gem install rails output next?
If you are very new you and you don't need specially the last version of Ruby. You can use Rails Installer http://railsinstaller.org/fr-FR.
To uninstall brew https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md

How can I install ruby on rails with rvm?

I've been searching around on how to install it through the terminal on my mac. I'm using snow leopard.
When I use the command: rvm install 1.9.3
I've also followed the other procedures that led me up to this to install, right now the current version is 1.8.3
Error running './configure --prefix="/Users/jose/.rvm/usr" ', please read /Users/jose/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Then it mentions something about xcode and autoreconf was not found in the PATH.
Error running 'patch -F 25 -p1 -N -f <"/Users/jose/.rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-e34840.diff"',please read /Users/jose/.rvm/log/ruby-1.9.3-p125/patch.apply.xcode-debugopt-fix-r34840.log
rvm requires autoreconf to install the selected ruby interpreter however autoreconf was not found in the PATH
I been trying for awhile now, and found out i need to have Xcode for snow leopard which I cannot find. So my last option will be to upgrade to lion but I don't know about upgrading. Kind of scared to upgrade and everything becomes buggy.
Rails 2.3.5
Jose-Gomezs-MacBook-Pro:~ josegomez$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Jose-Gomezs-MacBook-Pro:~ josegomez$ gem -v
1.8.15
Jose-Gomezs-MacBook-Pro:~ josegomez$ rvm -v
rvm 1.11.6 (stable) by Wayne E. Seguin , Michal Papis > [https://rvm.beginrescueend.com/]
Install brew, then:
brew install automake
Will add autoreconf to your path.
1.9.3 now works with the LLVM compiler in XCode 4.3 so you shouldn't have any issues installing the latest version from the App Store.
I rebuilt my mac last night and everything was pretty stock standard. RVM, Brew, XCode from the App Store, Command Line Tools from XCode, autoreconf from brew, 1.9.3-p125 from rvm.
For getting patch application problems - use rvm reinstall 1.9.3.
For installing ruby 1.8.7 you need GCC 4.2 like (gcc-4.2 program) not an LLVM based compiler (like clang), the easiest way to get it is osx-gcc-installer, you could also install Xcode 4.1 - but this is harder.
Please take a note that 1.9.3-p125 is not fully ready for clang, you still are better with gcc-4.2 form osx-gcc-installer / Xcode 4.1
I did it on my Mac and I remember changing some settings in my .bash_profile. Here is a link I followed to do it. Hope it works for you as well.
http://net.tutsplus.com/tutorials/ruby/how-to-install-ruby-on-a-mac/
Signing up for a free developer account with Apple will give you access to Xcode for Snow Leopard. Once you install Xcode and the included Developer Tools, you'll be all set to install Ruby on Rails with RVM.
only tittle related:
bash -s stable --rails < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
you can get more details here: https://gist.github.com/2246595 - this will enter guide mode that helps to get it app and running
Try this script by ThoughtBot to automatically configure your system:
https://github.com/thoughtbot/laptop
It does a.lot and generally will take a Lion system, get gcc installed, and get rvm and finally rails. highly recommend.
Just to close it off, I found out I had to push back my date on my mac to sometime before January 2012 and install xcode. After installation you can set the time back to normal and you should be good to go. But I got a copy of xcode from my instructor which is pretty cool.

Can't install Ruby on OS X

I'm trying to follow the installation instructions for Ruby on Rails from Hivelogic.com. I've done this before on previous installs of OSX without trouble. I'm having trouble this time installing on Snow Leopard.
At the end of the "make" step installing Ruby, I get a number of errors related to readline. Not sure if this matters, but here they are:
readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:730: error: (Each undeclared identifier is reported only once
readline.c:730: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
make: *** [all] Error 1
When I try to sudo make install, I get more errors. When I "which ruby", I get /usr/local/bin/ruby which is correct. But as soon as I try to use ruby, I get this message: "You need the Rosetta software to run ruby. The Rosetta installer is in Optional Installs on your Mac OS X installation disc." That's weird, but I installed Rosetta, and was able to proceed.
Except: I still have Ruby1.8.6 installed (not 1.8.7). "ruby -v" reports 1.8.6. 1.8.6 was the version that was migrated (I assume) from the Leopard install on this machine. In other words: where's my new Ruby? How do I get 1.8.7 (required by the current version of Rails) installed correctly?
I've always found macports the best way to install/manage my ruby versions. I have 1.8.6, 1.8.7 and 1.9.1 all installed using macports.
First, grab macports and install it.
Then, update (or create) your ~/.bashrc file to include the following line:
export PATH=/opt/local/bin:$PATH
This places all macports executables in front of you path, so you system will find them first.
Finally, install any of the versions of ruby you want:
sudo port install ruby186
sudo port install ruby
sudo port install ruby19
I also recommend installing rubygems from scratch after ruby is installed. Grab the latest rubygems release here and then run the following from inside the downloaded rubygems directory:
sudo ruby setup.rb
Hope this works out for you.
If you have snow leopard than 1.8.7 is pre-installed in /usr/bin
Another option is to use VirtualBox and install Ubuntu on VirtualBox. Ruby installation and usage is much smoother this way I have found, as I wasted a lot of time trying to get Ruby working properly on the Mac.

Resources