diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb
index 0dbdc08c4bb6d51a2d7c8bbcf5de9444762e8d8f..f1d0ea6360eaa9504790dd51b679f12b39fefe9c 100644
--- a/Library/Homebrew/cmd/uninstall.rb
+++ b/Library/Homebrew/cmd/uninstall.rb
@@ -46,9 +46,11 @@ module Homebrew
   ensure
     # If we delete Cellar/newname, then Cellar/oldname symlink
     # can become broken and we have to remove it.
+    if HOMEBREW_CELLAR.directory?
     HOMEBREW_CELLAR.children.each do |rack|
       rack.unlink if rack.symlink? && !rack.resolved_path_exists?
     end
+    end
   end
 
   def rm_pin(rack)