Last active
March 15, 2019 12:17
-
-
Save nanoxd/22d060c27491d748730a981f4a7a4826 to your computer and use it in GitHub Desktop.
Xcode Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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