Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Homebrew, Ruby, and Rails on OS X 10.10

OS X 10.10 Guide

Here's what I did to get things working.

1. Install Xcode 6

Yep, over at: https://developer.apple.com

2. Install the Command Line Tools (CLT)

http://adcdownload.apple.com/Developer_Tools/command_line_tools_os_x_10.10_for_xcode__june_2014/command_line_tools_for_osx_10_10_june_2014.dmg (thanks @thomaslindstrom)

3. Install Homebrew

Copy/pasted from the site:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

4. Update the brew Script

Open up /usr/local/bin/brew with your favorite editor.

I had to comment out the brew system detection, so that the last 6-7 lines looked like this:

#BREW_SYSTEM=$(uname -s | tr "[:upper:]" "[:lower:]")
#if [ "$BREW_SYSTEM" = "darwin" ]
#then
#    exec "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"
#else
    exec ruby -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"
#fi

5. Point Ruby 1.8 at Ruby 2.0

It looks like Homebrew somehow depends on Ruby being in Versions/1.8 (though even Mavericks ships with 2.0). Until Homebrew addresses this, we'll symlink our system version of Ruby to the one Homebrew looks for.

Create the folder:

sudo mkdir -p /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin

Then symlink the binary:

sudo ln -s /usr/bin/ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

6. Hack away!

My subsequent brew install commands seemed to work fine (ruby-build, redis, etc...). Along with rbenv, etc.

You'll probably need to install Bundler with gem install bundler if you haven't already.

Improve this Gist!

Leave a comment if something didn't work.

@DiederikvandenB
Copy link

DiederikvandenB commented Jun 4, 2014

People looking for the CLT outside of the developer program can find it here:
http://thepiratebay.se/torrent/10291112/X_Code_6_Beta_with_Command_Line_Tools_for_OS_X_10.10_Yosemite

Make sure to disable the Xcode.dmg from the torrent if you already have it to avoid having to wait too long for your download.

@caarlos0
Copy link

caarlos0 commented Jun 5, 2014

brew cask don't work...

@bendyorke
Copy link

bendyorke commented Jun 5, 2014

If anyone is using zsh and having issues with git, the people on SO were awesome here: http://stackoverflow.com/questions/24022582/osx-10-10-yosemite-beta-on-git-pull-git-sh-setup-no-such-file-or-directory

the solution was to append the following to your zshrc: [[ $(env | grep -c PATH) < 2 ]] || /usr/bin/login -f $USER

I know this doesn't apply to everyone, but zsh + git is a pretty popular combination :). It also fixes warnings that pop up with $ brew doctor regarding the path variable which was driving me crazy

@amoblin
Copy link

amoblin commented Jun 5, 2014

For Point 5. Point Ruby 1.8 at Ruby 2.0

Why not just modify brew.rb to change 1.8 to 2.0 ?

head -1 /usr/local/Library/brew.rb 
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
#!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -W0

@caius
Copy link

caius commented Jun 5, 2014

Instead of installing the CLT I instead installed Xcode 6 and changed it to be the active developer tools install with:

sudo xcode-select --switch /Applications/Xcode6-Beta.app/Contents/Developer/

And then I could use git, etc without having to install anything else.

@caius
Copy link

caius commented Jun 5, 2014

And it looks like Homebrew/legacy-homebrew@1bbcc4b means no need for step 5 to make ruby 1.8 appear to be available for ruby - homebrew now just uses ruby 2 in the system instead.

@caarlos0
Copy link

caarlos0 commented Jun 5, 2014

About homebrew-cask, seems like some iTerm weirdness: Homebrew/homebrew-cask#4685

@jwaldrip
Copy link

jwaldrip commented Jun 5, 2014

Has anyone had any issue installing ruby 1.9.x on 10.10? I am getting the following error:

$ rbenv install 1.9.3-p547
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /usr/local/var/rbenv/versions/1.9.3-p547

Downloading ruby-1.9.3-p547.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/9ba118e4aba04c430bc4d5efb09b31a0277e101c9fd2ef3b80b9c684d7ae57a1
Installing ruby-1.9.3-p547...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/1s/ct5g_n2s5l7c0z8jm2f39gp00000gn/T/ruby-build.20140605094148.16505
Results logged to /var/folders/1s/ct5g_n2s5l7c0z8jm2f39gp00000gn/T/ruby-build.20140605094148.16505.log

Last 10 log lines:
    0 enumerator.so

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

make: *** [encdb.h] Abort trap: 6
make: *** Waiting for unfinished jobs....
make: *** [.rbconfig.time] Abort trap: 6

@brandontravis
Copy link

brandontravis commented Jun 5, 2014

After starting with a fresh install of OS 10.10, download Xcode6-beta and the new command line tools and then doing a fresh install of homebrew using the above curl link, I still cannot run brew doctor. I took it a step further to follow the steps above and still brew doctor hangs. for the most part, it looks as though everything else with homebrew is working?

Not sure what exactly is causing this.

@jwaldrip
Copy link

jwaldrip commented Jun 5, 2014

@idealbrandon, are you using terminal or iterm2?

@fernandoaleman
Copy link

fernandoaleman commented Jun 7, 2014

@jwaldrip, I just encountered the same issue. Have you been able to resolve it?

@Showtimes
Copy link

Showtimes commented Jun 7, 2014

@caius Thank you! Was stuck until I did this.

@scottfister
Copy link

scottfister commented Jun 11, 2014

I keep getting this error: /usr/local/Cellar/rbenv/0.4.0/libexec/rbenv-hooks: line 32: cd: ../../../Cellar/rbenv-gem-rehash/1.0.0/etc/rbenv.d/exec: No such file or directory whenever I try to run something like ruby -v. It only occurs when I have if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi in my .bash_profile. I installed with the instructions above and cannot figure this out! Any help is appreciated. Edit: I fixed this issue by doing brew install rbenv-gem-rehash.

@edenchen-zz
Copy link

edenchen-zz commented Jun 14, 2014

has anyone got this to work?

getting this error on brew update:

/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0

getting this error on irb:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14 (Errno::EACCES) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:infu_mkdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in block (2 levels) in mkdir_p' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:inreverse_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in block in mkdir_p' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:ineach'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in mkdir_p' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:210:inwrite_gem_make_out'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:132:in build_error' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:171:inrescue in build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:156:in build_extension' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:inblock in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in each' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:inbuild_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in block in build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:inuse_ui'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:inbuild_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in contains_requirable_file?' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:inblock in find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in each' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:infind'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in find_inactive_by_path' from /Library/Ruby/Site/2.0.0/rubygems.rb:185:intry_activate'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:150:in block in search_file' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:158:inblock in each_localized_path'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:167:in each_sublocale' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:157:ineach_localized_path'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:145:in search_file' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:124:infind'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:108:in load' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:32:ininitialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/init.rb:114:in new' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/init.rb:114:ininit_config'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/init.rb:16:in setup' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb.rb:380:instart'
from /usr/bin/irb:12:in `

'

@jimbocortes
Copy link

jimbocortes commented Jun 17, 2014

had to do this
CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl --with-gcc=clang" rbenv install 2.1.2

or else

BUILD FAILED

Inspect or clean up the working tree at /var/folders/96/06k_d7m11cxf6z245d451_mr0000gn/T/ruby-build.20140617151358.28674
Results logged to /var/folders/96/06k_d7m11cxf6z245d451_mr0000gn/T/ruby-build.20140617151358.28674.log

Last 10 log lines:
checking for gcc-4.2... gcc-4.2
couldn't understand kern.osversion 14.0.0' checking for gcc... (cached) gcc-4.2 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in/var/folders/96/06k_d7m11cxf6z245d451_mr0000gn/T/ruby-build.20140617151358.28674/ruby-2.1.2':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use --host'. Seeconfig.log' for more details

@rkeniger
Copy link

rkeniger commented Jun 18, 2014

The OpenSSL stuff didn't work for me, but just using CONFIGURE_OPTS="--with-gcc=clang" rbenv install 2.1.1 worked fine. Thanks for the tip.

@danielbayerlein
Copy link

danielbayerlein commented Jun 28, 2014

Command Line Tools for OS X Yosemite 10.10

@chrisdelbuck
Copy link

chrisdelbuck commented Jul 3, 2014

CLT Download link fails for me unless coming directly from https://developer.apple.com/downloads/index.action

@dja
Copy link

dja commented Jul 19, 2014

@rkeniger That worked awesomely. Thanks!

@bdcheung
Copy link

bdcheung commented Jul 25, 2014

@rkeniger Worked for me too, thanks!

@Nikamura
Copy link

Nikamura commented Aug 7, 2014

You can install CLT tools by entering

    gcc

in terminal

@philippbosch
Copy link

philippbosch commented Sep 2, 2014

The OpenSSL configure options in @jimbocortes' comment were f***ed up by the markdown parser, I believe. This worked for me:

CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-gcc=clang" rbenv install 2.1.2 

@caseyhelbling
Copy link

caseyhelbling commented Sep 8, 2014

@philippbosch that worked for me. Thanks!

@fskirschbaum
Copy link

fskirschbaum commented Oct 7, 2014

macbookpro:~ fskirschbaum$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Whoops, the Homebrew installer has moved! Please instead run:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Also, please ask wherever you got this link from to update it to the above.
Thanks!

@Miladiir
Copy link

Miladiir commented Oct 9, 2014

@fskirschbaum Homebrew works fine with Yosemite now, even without following this gist.

@pph7
Copy link

pph7 commented Nov 26, 2014

Works for me. Thx!

@dsibiski
Copy link

dsibiski commented Jan 21, 2015

@philippbosch Thank you so much! After trying tons of different commands and options, this is the only one that finally worked.

@iSevenDays
Copy link

iSevenDays commented Jan 22, 2015

THANKS! Struggled for hours!

@doctorallen
Copy link

doctorallen commented Mar 10, 2015

I just installed this and it told me to get you to update the curl command for installing homebrew.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@HenriqueCarvalho
Copy link

HenriqueCarvalho commented Sep 12, 2015

@scottfister, thank so much! You solved my problem that I have been studying it for 3 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment