Last active
August 26, 2021 16:42
-
-
Save polqf/d294e0bc55a23ad1c39c to your computer and use it in GitHub Desktop.
SourceKit Fix
This file contains 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
# | |
# This fix should solve most of the problems with SourceKit (Not only with Swift, also with Obj-C). Such as: | |
# - Not having autocompletion | |
# - False errors | |
# | |
# This is just a temporal fix. The problem could eventually return. | |
# If that happens, just re-run this file | |
# | |
# The implementation comes from an answer in stackoverflow, which helped me a lot. | |
# | |
# Source: http://stackoverflow.com/questions/27083848/xcode-source-kit-will-not-stop-crashing-with-swift | |
# | |
# Pol Quintana. 2015 | |
# @poolqf | |
# | |
xcodeV = ARGV[0] || "Xcode" | |
puts "π» Closing XCode" | |
`osascript -e 'quit app "#{xcodeV}"'` | |
puts "π© Deleting Derived Data" | |
`rm -rf ~/Library/Developer/Xcode/DerivedData/` | |
puts "π© Deleting Cache File" | |
`rm -rf ~/Library/Caches/com.apple.dt.Xcode` | |
sleep(2) | |
puts "π DONE. Reopening XCode" | |
`open -a "#{xcodeV}"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment