diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index a32f2ef34ef66999c5047c95d3be36251db1da96..1808c4d9cf5eeffca8ca6a66648d94b1bea23125 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -194,8 +194,10 @@ module Homebrew
         next unless f.opt_prefix.directory?
         keg = Keg.new(f.opt_prefix.resolved_path)
         tab = Tab.for_keg(keg)
-        tab.installed_on_request = true
-        tab.write
+        unless tab.installed_on_request
+          tab.installed_on_request = true
+          tab.write
+        end
       end
 
       perform_preinstall_checks
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index fd59539dfd929bf3943e400a8174cf29bb1bfb54..db4b1c585304444bffb824265250de0db2c62fd0 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -100,11 +100,14 @@ class Tab < OpenStruct
   def self.for_keg(keg)
     path = keg.join(FILENAME)
 
-    if path.exist?
+    tab = if path.exist?
       from_file(path)
     else
       empty
     end
+
+    tab["tabfile"] = path
+    tab
   end
 
   # Returns a tab for the named formula's installation,
diff --git a/Library/Homebrew/test/tab_spec.rb b/Library/Homebrew/test/tab_spec.rb
index fec390c28c33a125d58e1b7fd2f62a6fd1496339..1b0836c93fa45bb85bc64757501e7b96b994a69d 100644
--- a/Library/Homebrew/test/tab_spec.rb
+++ b/Library/Homebrew/test/tab_spec.rb
@@ -258,7 +258,7 @@ describe Tab do
     it "can create a Tab for a non-existant Keg" do
       f.prefix.mkpath
 
-      expect(subject.tabfile).to be nil
+      expect(subject.tabfile).to eq(f_tab_path)
     end
   end