{"record":{"id":"f0b184c6099b58dd","repo":"ruby/rubygems","slug":"you-don-t-have-write-permissions-for-the-directo-f0b184","errorCode":null,"errorMessage":"You don't have write permissions for the #{directory} directory.","messagePattern":"You don't have write permissions for the #(.+?) directory\\.","errorType":"exception","errorClass":"Gem::FilePermissionError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/uninstaller.rb","lineNumber":225,"sourceCode":"    end\n\n    return if executables.empty?\n\n    executables = executables.map {|exec| formatted_program_filename exec }\n\n    remove = if @force_executables.nil?\n      ask_yes_no(\"Remove executables:\\n\" \\\n                 \"\\t#{executables.join \", \"}\\n\\n\" \\\n                 \"in addition to the gem?\",\n                 true)\n    else\n      @force_executables\n    end\n\n    if remove\n      bin_dir = @bin_dir || Gem.bindir(spec.base_dir)\n\n      raise Gem::FilePermissionError, bin_dir unless File.writable? bin_dir\n\n      executables.each do |exe_name|\n        say \"Removing #{exe_name}\"\n\n        exe_file = File.join bin_dir, exe_name\n\n        safe_delete { FileUtils.rm exe_file }\n        safe_delete { FileUtils.rm \"#{exe_file}.bat\" }\n      end\n    else\n      say \"Executables and scripts will remain installed.\"\n    end\n  end\n\n  ##\n  # Removes all gems in +list+.\n  #\n  # NOTE: removes uninstalled gems from +list+.","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/uninstaller.rb#L207-L243","documentation":"Error \"You don't have write permissions for the #{directory} directory.\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/uninstaller.rb:225 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix permissions on the gem directory or use sudo for system gems","Prefer `gem install --user-install` so gems live in your writable home directory"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}