Skip to content

Instantly share code, notes, and snippets.

@caius
Created November 5, 2011 13:49
Show Gist options
  • Save caius/1341516 to your computer and use it in GitHub Desktop.
Save caius/1341516 to your computer and use it in GitHub Desktop.
A script for showing the derived data folder for an Xcode workspace. Intended to be invoked from a custom behaviour
#!/usr/bin/env ruby
# This script currently only works if you have your derived data in the default location.
# Get the workspace name to search for, or exit with code 1 if no value in envariable
xcodeWorkspacePath = ENV["XcodeWorkspacePath"] || exit(1)
projectName = xcodeWorkspacePath[%r{/(\w+)\.xcodeproj}, 1]
#Get the folders in derived data that could match the workspace
derived_data = File.expand_path("~/Library/Developer/Xcode/DerivedData")
# Glob out the files matching our project
Dir["#{derived_data}/#{projectName}*"].each do |folder|
# Passing args in this fashion auto-escapes them
exec "open", folder
end
__END__
Example value for ENV["XcodeWorkspacePath"] is "/Users/caius/Projects/SkypeAnySize/SkypeAnySize.xcodeproj/project.xcworkspace" (Xcode 4.2, 10.7 mac app project)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment