diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index 63f8d7b479..ea3e1ab8ad 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -17,6 +17,23 @@ module Homebrew EOS end + def check_tmpdir_executable + f = Tempfile.new(%w[homebrew_check_tmpdir_executable .sh], HOMEBREW_TEMP) + f.write "#!/bin/sh\n" + f.chmod 0700 + f.close + return if system f.path + <<~EOS.undent + The directory #{HOMEBREW_TEMP} does not permit executing + programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP + in your #{shell_profile} to a different directory, for example: + export HOMEBREW_TEMP=~/tmp + echo 'export HOMEBREW_TEMP=~/tmp' >> #{shell_profile} + EOS + ensure + f.unlink + end + def check_xdg_data_dirs return if ENV["XDG_DATA_DIRS"].to_s.empty? return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share")