rod mclaughlin


Why do Rails developers use Macs? (22 mar 12)

 

On Linux, it's 'sudo apt-get install ruby; sudo apt-get install rubygems; gem install rails', you have to enter your login password once, and you're off.

On the Apple Macintosh, it's a bit more complicated. (I take it as read that Microsoft doesn't exist).

First, you need to get 'XCode'. To get that, you need to find the right page at apple.com, and enter your Apple ID and password, which you've forgotten. If you give Apple your e-mail address, they'll send you a link to reset your password, which is Very$ecure!ndeed1234.

Then you go through various web pages, click on 'View In Mac App Store', and it takes you to a window with a picture of a hammer on it. Click on the hammer, find the dropdown where it says 'Free' and click on it. It changes to 'Install App'. Click on that. It asks for your Apple ID and password. Enter them. It asks for lots more details, including a credit card number. 

It now says "You must first log in to the My Info Web page", and provides a button labeled "Update Security Info", without telling you where the My Info Web page is. Click the button. It opens another page, which says "Cannot open the page myinfo.apple.com because Safari can't open a secure connection".

And RVM, which is almost universally used by Rails developers:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

source ~/.bash_profile
rvm install ruby-1.9.3-p125
Error running ' ./configure --prefix="/Users/rod/.rvm/usr"  ', 
please read /Users/rod/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Compiling yaml in /Users/rod/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/rod/.rvm/log/ruby-1.9.3-p125/yaml/make.log
ruby-1.9.3-p125 - #fetching 
ruby-1.9.3-p125 - #extracted to /Users/rod/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring 
Error running ' ./configure --prefix=/Users/rod/.rvm/rubies/ruby-1.9.3-p125
   --enable-shared --disable-install-doc --with-libyaml
   --with-opt-dir=/Users/rod/.rvm/usr ', please read /Users/rod/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.
configure: error: C compiler cannot create executables
See `config.log' for more details

 

The C compiler cannot create executables. A C compiler has some other purpose I'm not aware of?

Google leads to to a page which tells you to do this

 ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

This doesn't work. More googling, and it says to find mxcl-homebrew-4c6bc7b.tar.gz at github and unzip it. 

This doesn't work. Another page recommends doing this

 ruby -e "$(curl -fsSL https://github.com/mxcl/homebrew/blob/master/Library/Contributions/install_homebrew.rb)"

This doesn't work. More googling finds this

 /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

This actually installs something.

You then enter 

 brew doctor

and

 brew install git

This fails, but tells you to look at four pages, including

 https://github.com/mxcl/homebrew/issues/8643

none of which tell you anything. So you carry on googling, and find that you have to get 'XCode Command Line Tools' from the 'XCode Preferences', but nothing that tells you where that is. Eventually, I found XCode by running a 'Finder window' and double clicking on 'XCode', then 'XCode' in the top left hand corner of the screeen, then 'Preferences', then 'Downloads', then 'Command Line Tools', then 'Install'. 

It pops up a message box, which says 'Rod McLaughlin does not have access to Command Line Tools'.

It IS a 'known issue' though: 

 https://discussions.apple.com/thread/3821351

That's always reassuring - it means it doesn't work, but they know about it.

To be fair, this page 

 http://prod.lists.apple.com/archives/xcode-users/2012/Mar/msg00619.html

says "We're looking into this issue. Please stay tuned." and it is dated today.

And they fixed it today. 'Install' from 'Command Line Tools' in the 'Components' section of the 'XCode' application installed, and 

 brew install git

installed git, and, finally,

 rvm install ruby-1.9.3-p125

installed Ruby. From then on, it's plain sailing to Rails. RVM is at http://beginrescueend.com, and is highly recommended. 

Suppose you've successfully installed RVM, and the latest Ruby, say, 1.9.3. But you have an old app that requires Ruby 1.8.7. No problem - under Linux - it's just

rvm install 1.8.7
rvm use 1.8.7
rvm gemset create rails239

etc.

but on a Mac, RVM recommends doing this:

 rvm install 1.8.7 --with-gcc=clang

However, that doesn't work. If you installed RVM and the latest version of Ruby, you need to

 a. comment out the RVM line in your ~/.bash_profile file, like this:
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 
 b. open a new Terminal window
 c. gem install rails -v 2.3.9
 d. remove the # from the beginning of the RVM line in ~/.bash_profile

 

I wouldn't recommend Mac for developers.

 

The UI is cool, though. The web browser understands when you are typing in a link, and it guesses which one you want, and you hit enter, it goes to that link. In every other browser, you have to hit the down arrow first. The new 'use two fingers to move the page' is cool too. It's the opposite of what you are used to: sliding the scrollbar down makes the page go up, but with the two fingers method, the page moves the same way as your fingers. 

And it goes with my handbag.


Correction, Jan 14 2013. You don't need to join the Apple App Store:

http://railsapps.github.io/installrubyonrails-mac.html

 



Back
Portland London