Tuesday, January 29, 2013

Setting up HomeBrew on Mac Mini

Building blocks: Homebrew, XCode, X11, and Git

This guide is for starting from a fresh Mountain Lion install, with nothing else installed. You can approximate that state, by getting rid of all your macports and finks and what have you. Delete your /usr/local. Uninstall all XCodes are their developer tools.
Install homebrew:
ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)
Homebrew lets us effortlessly install things from source. It is good, but it needs some help: Mountain Lion doesn’t come with developer tools, and homebrew is not able to do much right now.
Go to the App Store and download XCode (I am writing this in early August 2012, and the current version is 4.4). This can take a little bit, so while it’s downloading, let’s install X11 libraries that Mountain Lion stripped out.
Go here and download 2.7.2+. Install it, and after it’s done, fix the symlink it makes:
ln -s /opt/X11 /usr/X11
When XCode download is done, launch it and go to Preferences, Downloads tab, and install the Command Line Tools. When it finishes, we are almost ready to brew. Before we do, let’s have XCode tell everyone where the tools are (this tip is from Get Mountain Lion and Homebrew to Be Happy).
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Open up a new shell to make sure everything is loaded from scratch, and check that homebrew is good to go:
brew doctor
Fix the stuff it complains about until it doesn’t.
Now let’s get git:
brew install git




When I ran brew doctor, I complained:

$ git config --global core.autocrlf input

$ brew doctor
Warning: Suspicious Git newline settings found.

The detected Git newline settings will cause checkout problems:
  core.autocrlf = input

If you are not routinely dealing with Windows-based projects,
consider removing these settings.

Alternatively run:
`git config -f /usr/local/.git/config --add core.autocrlf false`
Warning: Suspicious git origin remote found.

With a non-standard origin, Homebrew won't pull updates from
the main repository. The current git origin is:
  

Unless you have compelling reasons, consider setting the
origin remote to point at the main repository, located at:
  https://github.com/mxcl/homebrew.git

Brew did not like  core.autocrlf = input

 core.autocrlf = false worked better...

$ git config --global core.autocrlf false
$ brew doctor
Warning: Suspicious git origin remote found.

With a non-standard origin, Homebrew won't pull updates from
the main repository. The current git origin is:
  

Unless you have compelling reasons, consider setting the
origin remote to point at the main repository, located at:
  https://github.com/mxcl/homebrew.git

Still have problem with ORIGIN

$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: (none)
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.1-x86_64
Xcode: 4.6
CLT: 4.6.0.0.1.1358221012
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Run brew update to refresh the home brew install...

$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 98489, done.
remote: Compressing objects: 100% (42612/42612), done.
remote: Total 98489 (delta 69326), reused 81362 (delta 54988)
Receiving objects: 100% (98489/98489), 14.62 MiB | 813 KiB/s, done.
Resolving deltas: 100% (69326/69326), done.
From https://github.com/mxcl/homebrew
 * [new branch]      formula-cleanup -> origin/formula-cleanup
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      go         -> origin/go
 * [new branch]      master     -> origin/master
 * [new branch]      superwip   -> origin/superwip
HEAD is now at 0fa466c #{prefix} should be interpolated
Already up-to-date.

$ brew doctor
Your system is raring to brew.

Looking good...

$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 0fa466c17aae2097d77f555a6e98a1466a8963f0
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.1-x86_64
Xcode: 4.6
CLT: 4.6.0.0.1.1358221012
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

So, it seems that installing Home Brew does not get the most latest version, which was needed b/c they recently fixed the ORIGIN bug.



References




http://sergeykarayev.com/work/2012-08-08/setting-up-mountain-lion/




Sponsor Ads


9 comments:

  1. Thanks for the tip about the origin. Maybe brew just didn't initialise a git repo on install. It reports an empty current git repo origin. Hence the:

    "The current git origin is:" zilch

    ReplyDelete
  2. You're welcome, Bas. Thank you for leaving a comment. ~ Lex

    ReplyDelete
  3. Thanks for the heads up. So it seems the docs might be backwards? Had I run brew update prior to brew doctor I might not have encountered "Warning: Suspicious git origin remote found" warning?

    ReplyDelete
  4. yay that worked very well, thank you kindly :)

    ReplyDelete
  5. It's a nice post and have much information. I'll bookmark and be back again...
    IT Support Services

    ReplyDelete
  6. Thanks for the post. please keep posting.

    ReplyDelete
  7. Thanks for your nice posting need more information about Radiologic technologist

    ReplyDelete
  8. FYI - I had permissions issues running postgres after restoring from a TimeMachine image. So, I referred back to this post to see how to reinstall developer tools. These instructions still work. Well, the only difference was developer tools were installed, but I had to click the "Accept" button.

    ReplyDelete
  9. Not working for me. every time doctor is complain for different origin

    ReplyDelete