title: Failing to bundle install tiny_tds on Mac OS X 10.8 with Homebrew FreeTds
body: <p><strong>MY QUESTION</strong><br>
  What are some surefire steps I can take to 100% get this working?
  I would need real instructions, not one liner answers or vague conceptual descriptions of the process.</p>
  
  <p>Let's get to the bottom of this.
  It would appear that there are conflicts somewhere and I've had subpar assistance from the gem developer on GitHub in relation to my experience with Ruby / Rails / Bundler / Homebrew so it's not completely their fault :P
  But I need to figure out how to get this working ASAP so here goes with my current state of this problem.</p>
  
  <hr>
  
  <p><strong>UPDATE: 2/25/2013</strong><br>
  Updated GCC / XCODE Version 4.6 (4H127) and downloaded latest version of XCODE COMMAND-LINE TOOLS
  and now iconv_open() is showing up in the extconf checker.
  Now I'm getting these errors:</p>
  
  <p>I believe they are now issues with tiny_tds and compatibility with latest xcode paths.</p>
  
  <pre><code>    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
  
              /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
      checking for iconv_open() in iconv.h... yes
      checking for sybfront.h... yes
      checking for sybdb.h... yes
      checking for tdsdbopen() in -lsybdb... yes
      checking for ct_bind() in -lct... yes
      creating Makefile
  
      make
      xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I-I/usr/local/php5/include -I-I/usr/include -I-I/usr/local/include -I-I/opt/local/include -I-I/usr/local/MacGPG2/include -I-I/opt/sm/pkg/active/include -I/usr/local/php5/include -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/local/MacGPG2/include -I/opt/sm/pkg/active/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -c client.c
      xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
      xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I-I/usr/local/php5/include -I-I/usr/include -I-I/usr/local/include -I-I/opt/local/include -I-I/usr/local/MacGPG2/include -I-I/opt/sm/pkg/active/include -I/usr/local/php5/include -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/local/MacGPG2/include -I/opt/sm/pkg/active/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -c result.c
      xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
      xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I-I/usr/local/php5/include -I-I/usr/include -I-I/usr/local/include -I-I/opt/local/include -I-I/usr/local/MacGPG2/include -I-I/opt/sm/pkg/active/include -I/usr/local/php5/include -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/local/MacGPG2/include -I/opt/sm/pkg/active/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -c tiny_tds_ext.c
      xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
      cc  -pipe -bundle -undefined dynamic_lookup -o tiny_tds.bundle client.o result.o tiny_tds_ext.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/heroku/lib -L/usr/local/php5/lib -L/usr/local/Cellar/ruby/1.9.3-p194/lib -L/usr/lib -L/usr/local/lib -L/opt/local/lib -L/usr/local/MacGPG2/lib -L/opt/sm/pkg/active/lib -L/Users/rountrjf/.rvm/lib -L/usr/local/Cellar/vertx/lib -L/usr/local/Cellar/vertx/mods/node.vert.x/lib -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L.       -lruby -lct -lsybdb  -lpthread -ldl -lobjc   
      i686-apple-darwin11-llvm-gcc-4.2: client.o: No such file or directory
      i686-apple-darwin11-llvm-gcc-4.2: result.o: No such file or directory
      i686-apple-darwin11-llvm-gcc-4.2: tiny_tds_ext.o: No such file or directory
      make: *** [tiny_tds.bundle] Error 1
  
  Alright, since /Developer doesn't exist.
  I used `sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer` thinking that would fix it.  Now I'm back to square one... iconv_open() not found when checked with `extconf.rb`
  </code></pre>
  
  <p><strong>UPDATE 2: 2/25/2013</strong><br>
  OKAY, so I reinstalled everything, Ruby / Rails / etc.
  And used some advice from a commenter to use ":path =>"
  and here is my output now when I run <code>rails s</code></p>
  
  <pre><code>/Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- tiny_tds (LoadError)
      from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
      from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
      from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
      from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:31:in `sqlserver_connection'
      from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
  </code></pre>
  
  <hr>
  
  <p><strong>THINGS I'VE TRIED</strong>  </p>
  
  <p><strong><em>1.) The initial EASY setup instructions like any other...</em></strong></p>
  
  <pre><code>$ rails new test_app
  $ cd test_app
  </code></pre>
  
  <p>Now add these lines to <code>Gemfile</code></p>
  
  <pre><code>gem 'tiny_tds'
  gem 'activerecord-sqlserver-adapter'
  </code></pre>
  
  <p>Now continue commands...</p>
  
  <pre><code>$ bundle install
  
  Fetching gem metadata from https://rubygems.org/...........
  Fetching gem metadata from https://rubygems.org/..
  Resolving dependencies...
  Using rake (10.0.3) 
  Using i18n (0.6.1) 
  Using multi_json (1.6.1) 
  Using activesupport (3.2.12) 
  Using builder (3.0.4) 
  Using activemodel (3.2.12) 
  Using erubis (2.7.0) 
  Using journey (1.0.4) 
  Using rack (1.4.5) 
  Using rack-cache (1.2) 
  Using rack-test (0.6.2) 
  Using hike (1.2.1) 
  Using tilt (1.3.3) 
  Using sprockets (2.2.2) 
  Using actionpack (3.2.12) 
  Using mime-types (1.21) 
  Using polyglot (0.3.3) 
  Using treetop (1.4.12) 
  Using mail (2.4.4) 
  Using actionmailer (3.2.12) 
  Using arel (3.0.2) 
  Using tzinfo (0.3.35) 
  Using activerecord (3.2.12) 
  Using activerecord-sqlserver-adapter (3.2.10) 
  Using activeresource (3.2.12) 
  Using bundler (1.2.4) 
  Using coffee-script-source (1.4.0) 
  Using execjs (1.4.0) 
  Using coffee-script (2.2.0) 
  Using rack-ssl (1.3.3) 
  Using json (1.7.7) 
  Using rdoc (3.12.1) 
  Using thor (0.17.0) 
  Using railties (3.2.12) 
  Using coffee-rails (3.2.2) 
  Using jquery-rails (2.2.1) 
  Using rails (3.2.12) 
  Using sass (3.2.5) 
  Using sass-rails (3.2.6) 
  Installing tiny_tds (0.5.1) with native extensions 
  Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
  
          /usr/local/Cellar/ruby/1.9.3-p194/bin/ruby extconf.rb 
  checking for iconv_open() in iconv.h... no
  checking for iconv_open() in -liconv... no
  -----
  libiconv is missing.
  -----
  *** extconf.rb failed ***
  Could not create Makefile due to some reason, probably lack of
  necessary libraries and/or headers.  Check the mkmf.log file for more
  details.  You may need configuration options.
  
  Provided configuration options:
      --with-opt-dir
      --without-opt-dir
      --with-opt-include
      --without-opt-include=${opt-dir}/include
      --with-opt-lib
      --without-opt-lib=${opt-dir}/lib
      --with-make-prog
      --without-make-prog
      --srcdir=.
      --curdir
      --ruby=/usr/local/Cellar/ruby/1.9.3-p194/bin/ruby
      --enable-lookup
      --disable-lookup
      --with-iconv-dir
      --without-iconv-dir
      --with-iconv-include
      --without-iconv-include=${iconv-dir}/include
      --with-iconv-lib
      --without-iconv-lib=${iconv-dir}/lib
      --with-freetds-dir
      --without-freetds-dir
      --with-freetds-include
      --without-freetds-include=${freetds-dir}/include
      --with-freetds-lib
      --without-freetds-lib=${freetds-dir}/lib
      --with-iconvlib
      --without-iconvlib
  
  
  Gem files will remain installed in /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/gems/tiny_tds-0.5.1 for inspection.
  Results logged to /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/gems/tiny_tds-0.5.1/ext/tiny_tds/gem_make.out
  An error occurred while installing tiny_tds (0.5.1), and Bundler cannot continue.
  Make sure that `gem install tiny_tds -v '0.5.1'` succeeds before bundling.
  </code></pre>
  
  <p><strong>OUTPUT OF <code>tsql -C</code></strong></p>
  
  <pre><code>$ tsql -C
  Compile-time settings (established with the "configure" script)
                              Version: freetds v0.91
               freetds.conf directory: /usr/local/Cellar/freetds/0.91/etc
       MS db-lib source compatibility: no
          Sybase binary compatibility: no
                        Thread safety: yes
                        iconv library: yes
                          TDS version: 7.1
                                iODBC: yes
                             unixodbc: no
                SSPI "trusted" logins: no
                             Kerberos: no
  </code></pre>
  
  <p><strong><em>2.) IMAGINARY SUCCESS / FAKE IT TIL YOU MAKE IT / A BIG LET DOWN / ADVANCED SETUP INSTRUCTIONS</em></strong><br>
  Found this blog entry...
  <a href="http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html" rel="nofollow noreferrer">http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html</a></p>
  
  <p>I then located my correct paths to the libiconv library and the freetds library.
  Next, I ran it like this:</p>
  
  <pre><code>$ sudo gem install tiny_tds -- --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib --with-freetds-lib=/usr/local/Cellar/freetds/0.91/lib --with-freetds-include=/usr/local/Cellar/freetds/0.91/include
  Password:
  Building native extensions.  This could take a while...
  Successfully installed tiny_tds-0.5.1
  1 gem installed
  Installing ri documentation for tiny_tds-0.5.1...
  Installing RDoc documentation for tiny_tds-0.5.1...
  </code></pre>
  
  <p>Tried <code>bundle_install</code> again, and shock... it still isn't installing via <code>gem 'tiny_tds'</code> in Gemfile...</p>
  
  <p>So I remove tiny_tds from Gemfile and proceed to start the server up anyway...
  And as expected...</p>
  
  <pre><code>$ rails s
  =&gt; Booting WEBrick
  =&gt; Rails 3.2.12 application starting in development on http://0.0.0.0:3000
  =&gt; Call with -d to detach
  =&gt; Ctrl-C to shutdown server
  Exiting
  /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- tiny_tds (LoadError)
  ...
  </code></pre>
  
  <p><strong><em>3.) MINI PORTILE</em></strong></p>
  
  <pre><code>$ sudo gem install mini_portile
  $ sudo gem install rakecompiler
  $ rake TINYTDS_FREETDS_VERSION="current"
  Could not find gem 'tiny_tds (&gt;= 0) ruby' in the gems available on this machine.
  Run `bundle install` to install missing gems.
  </code></pre>
  
  <hr>
  
  <p><strong>OTHER RELATED QUESTIONS AND RESOURCES</strong>  </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/12043003/error-installing-tinytds-on-osx-10-6-via-gem-install-tiny-tds">Error installing TinyTDS on OSX 10.6 via gem install tiny_tds</a>
  (not informative at all... due to the fact that it isn't working for
  me at all.)</li>
  <li><a href="https://stackoverflow.com/questions/9369454/freetds-mac-os-x-miniportile">FreeTDS Mac OS X MiniPortile</a>
  (Not very informative on the approach of miniportile or how to use
  it...)</li>
  <li><a href="https://stackoverflow.com/questions/9997722/homebrew-tinytds-freetds-bundle-error">Homebrew / TinyTDS / FreeTDS bundle error</a>
  (relates to linux, not Mac)</li>
  <li><a href="https://stackoverflow.com/questions/7525109/ror-unable-to-install-tiny-tds">ROR + Unable to install tiny_tds</a></li>
  <li><a href="http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html" rel="nofollow noreferrer">http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html</a>
  (a blog entry that gave me false hope)</li>
  <li><a href="https://github.com/rails-sqlserver/tiny_tds/issues/71" rel="nofollow noreferrer">https://github.com/rails-sqlserver/tiny_tds/issues/71</a> (github issue I commented in where I received some advise that I didn't understand well enough to translate into a success story)</li>
  <li><a href="https://github.com/rails-sqlserver/tiny_tds" rel="nofollow noreferrer">https://github.com/rails-sqlserver/tiny_tds</a> (github for tiny_tds gem)</li>
  </ul>