Skip to content

Instantly share code, notes, and snippets.

@nanoxd
Last active March 15, 2019 12:17
Show Gist options
  • Save nanoxd/22d060c27491d748730a981f4a7a4826 to your computer and use it in GitHub Desktop.
Save nanoxd/22d060c27491d748730a981f4a7a4826 to your computer and use it in GitHub Desktop.
Xcode Scripts
#!/usr/bin/env sh
# Xcode sometimes gets sad and won't index or other shenanigans. You can easily cheer up Xcode
# and get things happy again by simply removing some files. This little script does just that.
# Quit Xcode
osascript -e 'tell app "Xcode" to quit'
# Remove derived data
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# Remove Carthage Cache
rm -rf ~/Library/Caches/{carthage,org.carthage.CarthageKit}
# Open either Xcode workspace or project
x
#!/usr/bin/env ruby
XCODE_PATH = File.expand_path(File.join(`xcode-select -p`.chomp, '../..'))
def open_cmd(pattern)
files = Dir.glob(pattern)
`open -a "#{XCODE_PATH}" "#{files.first}"` and exit if files.count == 1
end
open_cmd '*.xcworkspace'
open_cmd '*.xcodeproj'
puts 'No Xcode workspaces or projects found.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment