{"record":{"id":"41ddd7dc4cdcd9a8","repo":"CocoaPods/CocoaPods","slug":"project-directory-is-not-a-valid-directory","errorCode":null,"errorMessage":"`#{@project_directory}` is not a valid directory.","messagePattern":"`#(.+?)` is not a valid directory\\.","errorType":"exception","errorClass":"Informative","httpStatus":null,"severity":"error","filePath":"lib/cocoapods/command/options/project_directory.rb","lineNumber":30,"sourceCode":"          end\n        end\n\n        def self.included(base)\n          base.extend(Options)\n        end\n\n        def initialize(argv)\n          if project_directory = argv.option('project-directory')\n            @project_directory = Pathname.new(project_directory).expand_path\n          end\n          config.installation_root = @project_directory\n          super\n        end\n\n        def validate!\n          super\n          if @project_directory && !@project_directory.directory?\n            raise Informative, \"`#{@project_directory}` is not a valid directory.\"\n          end\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":12,"sourceCodeEnd":37,"githubUrl":"https://github.com/CocoaPods/CocoaPods/blob/b80e113e28a7e23cd6dbc169f0c923f6b48bf7a2/lib/cocoapods/command/options/project_directory.rb#L12-L37","documentation":"The --project-directory option expands the given path, assigns config.installation_root, and in validate! raises Informative unless Pathname#directory? is true. Both a nonexistent path and a path that is a regular file fail the check, so the value must name an existing folder.","triggerScenarios":"`pod install --project-directory=X` where X does not exist, X is a file (e.g. the .xcodeproj bundle), or a mistyped relative path resolved against the wrong cwd.","commonSituations":"Passing the Xcode project file instead of its containing folder; relative paths interpreted from a different working directory in scripts; stale paths after the project moved.","solutions":["Verify the path exists and is a folder: `ls -ld <path>`","Use an absolute path to avoid cwd-relative surprises","Create the directory first if it is expected but missing"],"exampleFix":"# before\n$ pod install --project-directory=MyApp.xcodeproj\n[!] `/abs/MyApp.xcodeproj` is not a valid directory.\n\n# after\n$ pod install --project-directory=MyApp   # the folder containing the project","handlingStrategy":"validation","validationCode":"dir = File.expand_path(ENV['POD_PROJECT_DIR'] || '.')\nabort \"#{dir} is not a directory\" unless File.directory?(dir)\nsystem('pod', 'install', '--project-directory', dir) or exit $?.exitstatus","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an absolute directory to --project-directory","Remember the value is a folder, not the .xcodeproj file","Validate paths from scripts with File.directory? before invoking pod"],"tags":["project-directory","path-validation","cli","cocoapods"],"backgroundTag":"invalid-directory-path","analyzedSha":"b80e113e28a7e23cd6dbc169f0c923f6b48bf7a2","analyzedAt":"2026-08-21T15:07:28.652Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}