diff --git a/rakelib/builder.rb b/rakelib/builder.rb
index f19bbe9..3e8e6a0 100644
--- a/rakelib/builder.rb
+++ b/rakelib/builder.rb
@@ -1,6 +1,8 @@
 # User customizable variables.
 # These variables can be set from the command line. Example:
 #    $ rake framework_instdir=~/Library/Frameworks sym_instdir=~/bin
+require 'fileutils'
+require 'tempfile'
 
 $builder_options = {}
 
@@ -55,8 +57,36 @@ end
 
 LLVM_CONFIG = `which llvm-config`.strip
 if LLVM_CONFIG.empty?
-  $stderr.puts "The `llvm-config' executable was not located in your PATH. Please make sure LLVM is correctly installed on your machine or that your PATH is correctly set."
-  exit 1
+  $stderr.print "The `llvm-config' executable was not located in your PATH. Install it now? "
+  if STDIN.gets =~ /y/
+    working_dir = FileUtils.pwd
+    temp_dir = File.join(Dir.tmpdir, '-tmp-llvm-install-')
+    FileUtils.mkdir(temp_dir)
+    File.open(File.expand_path('../../README.rdoc', __FILE__), 'r') do |file|
+      file.each_line do |line|
+        if line =~ /^\* LLVM trunk/
+          FileUtils.cd temp_dir
+          until file.readline =~ /^\s*\$/; end
+          while $_ =~ /^\s*\$/
+            if $_ =~ /cd/ # Changing directory needs fileutil
+              FileUtils.cd $_[/cd\s*(.*$)/, 1]
+            else
+              system($_[/^\s*\$\s(\S.*$)/, 1])
+            end
+            file.readline
+          end
+          FileUtils.cd working_dir
+          File.rm_rf temp_dir
+          break
+        else
+          next
+        end
+      end
+    end
+    LLVM_CONFIG = `which llvm-config`.strip
+  else
+    exit 1
+  end
 end
 
 version_h = File.read('version.h')
