Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode is running really slow

Tags:

I've recently tried to use Xcode 8 to make iOS apps and to test things in Swift however it is impossible to work on as doing a simple 'print("Hello World")' takes easily over a minute to process to print it to the console, I tried doing regular development as well by creating UI buttons etc. but when I try to compile it, it is too slow to work and that is with simple things. My computer is the Mid 2012 Macbook Pro Non-retina with 4GB of RAM, not a quick computer but I can program in Python without these problems. If anyone knows some solutions please tell me! Thanks.

like image 389
Richard Wessels Avatar asked Dec 15 '16 14:12

Richard Wessels


People also ask

Why is my Xcode running so slow?

Running With Low Disk Space If your disk has less than 20GB remaining, then your overall computer will slow down due to low disk space and you may find it hard to do your regular work on your computer. You must keep your disk space free in order to have a smooth working experience.

Why is Xcode so slow on Mac?

With 4GB of RAM, Xcode is going to swap to disk a lot. With a spinning disk, swapping will be slow. If you can upgrade to an SSD and/or add RAM, that will help, otherwise you're kind of stuck.

Why does Xcode take so long to compile?

Xcode has inbuilt features that allow you to identify functions and expressions that are causing longer compile times. You can specify a compile time limit and identify areas in your codebase that exceed this limit. Open up your project's build settings and add the following flags to your Other Swift Flags .


2 Answers

When you build a project for the first time do it normally (it will take a while like you described)

After the first build Go to Product -> Scheme -> Edit Scheme. Select Build in left side column and uncheck Find implicit dependencies.

This appears to be a well known problem: https://forums.developer.apple.com/thread/62737

"If there's not enough context to decide, the compiler has to go with the conservative choice and record it as cascading."

like image 156
Mike Avatar answered Sep 24 '22 04:09

Mike


Same issue for me. I had execute these instructions two times before the app would launch without hanging for a minute.

  1. Unpair your phone from xcode
  2. Launch xcode with your phone not plugged in
  3. Plug your phone in
  4. In xcode, under devices, unpair your phone
  5. Stop xcode
  6. Run the following commands
  • rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport
  • rm -rf ~/Library/Developer/Xcode/iOS\ Device\ Logs
  • rm -rf ~/Library/Developer/Xcode/DerivedData
  1. Start xcode
  2. Plug phone in
like image 43
Priyanka Jadhav Avatar answered Sep 26 '22 04:09

Priyanka Jadhav