diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index fbfe46e71bd8d50131be92a5ca82e703259a1a1d..5a3aeb7b32c4d18abe6abd9cfcc03a538b33d123 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -184,6 +184,14 @@ module Homebrew
           # FormulaInstaller will handle this case.
           formulae << f
         end
+
+        # Even if we don't install this formula mark it as no longer just
+        # installed as a dependency.
+        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
       end
 
       perform_preinstall_checks