31.05.2020»»воскресенье

Mac Library Caches Cleanup

31.05.2020
    84 - Comments

There are a number of reasons why, when you’re building or testing in Xcode, you might want to clear the cache. Let’s say, for example, that you’re using the iOS simulator to test a website in order to see how it works on an iPhone or iPad. If you make changes to, say, the JavaScript on the site after testing, chances are that the site will load JavaScript from cache, rather than from the server, and you won’t see the changes you’ve made. Deleting the cache allows you to force the simulator to reload the code from the server. Another reason for clearing your Xcode cache is that it can help resolve issues with Xcode crashing.

Mac Library Caches Cleanup Version

There are several solutions to clearing the cache, and we’ll cover the best of them here. We’ll also show you a solution that’s easier than all the others, thanks to CleanMyMac X.

Clean up system cache data manually. You can find and delete system cache in the same way as user cache,. Going to /Library/Caches and hit Enter to removing the insides of the folders with the app name. System cache folders are named com.apple and should be backed up for safety. Go into the com.apple folders and delete the files inside of. Enter your Mac's password in the action-confirmation pop-up to clear your computer's cache. Related coverage from How To Do Everything: Tech: How to clear the cache on your iPhone and make it run.

How to clear Xcode cache manually

#1. Clean the build

Tip: If you’re trying to fix a problem with Xcode crashing, it’s worth cleaning the project build first. This will get rid of the current build and create a new one next time you run the code.

  1. With the project open in code, go to the menu bar, choose Product, and select Clean or:
  2. With the project open, press Command + Shift + K.

#2. Clean out the build folder

To clean out the build folder, and get rid of cache files, do the following:

  1. In the Code project, click on the Product menu while holding down the Option (Alt) key and choose Clean build folder, or:
  2. Press Command + Shift + Option + K.

#3. Reset Simulator content and settings

If neither of the steps above resolves your problem, try resetting the simulator content and settings:

Go to the menu and choose iOS Simulator, then click Reset Content and Settings.

#4. Delete derived data

If you’re still having problems, try deleting derived data, which will force Xcode to recreate it when you next run it.

  1. In the menu, choose Window, then Organizer.
  2. Now select Projects, and then click Select your project.
  3. Choose the project whose derived data you want to delete.
  4. In the window that opens, you’ll see see the Derived Data folder listed, along with its Finder path.
  5. To the right of the folder, there’s a Delete button. Press it.

Now, delete the module cache.

  1. Go to: ~/Library/Developer/Xcode/DerivedData/ModuleCache.
  2. Drag the files from the ModuleCache folder to the Trash and empty it.
Library

#5. iOS device support

There’s another folder inside DerivedData, called iOS device support. For every iOS version you test using the simulator, a new folder is created inside this folder. That can build up over time. You can delete all these subfolders (though, not the iOS device support folder itself) and Xcode will create a new one the next time you run the simulator. If you’re uncomfortable deleting them completely, you can move them to a temporary folder until you’re sure that moving them hasn’t caused any problems, and then delete them afterwards.

#6. Use Terminal

If none of the above helps, you can use Terminal to reset Xcode’s preferences.

  1. Launch Terminal from Applications > Utilities
  2. Type: defaults delete com.apple.dt.Xcode

When you next launch Xcode, it will create new preferences.

There is also a method of cleaning cache files that involves navigating to ‘private/var/folders’ (use the Go menu in the Finder and choose Go to Folder, then type that path), digging through folders until you find an Xcode cache file and deleting it. However, we wouldn’t recommend this route unless you are absolutely certain you know what you’re doing. Removing the wrong file can create lots of problems, not just in Xcode but in the OS as a whole. In some instances, users who have done that have had to reinstall macOS from scratch.

How to clear Xcode cache the easy way

Remember we said that there was an easier way to delete cache in Xcode? Well, a new feature in CleanMyMac X allows you to clean your iOS Simulator at the click of a couple of buttons. Like everything else, it’s quick and easy to use, and won’t risk running into problems with the file system. Here’s how to use CleanMyMac X:

  1. Download the app here (for free) and launch it.
  2. Go to the System Junk tab on the left.
  3. Click Scan.
  4. Click Review Details if you want to know what the app has found.
  5. Click Remove.

That’s it!

Mac Library Caches Cleanup 2017

If you’re having problems with Xcode and need to clean the project build or clear out the cache, following the steps above will help them. It’s a good idea to follow the manual steps in order, checking each time whether the problem has been resolved. Using the method of navigating to “private/var/folders” is not recommended because while it might fix the issues you’re having, it carries the risk of messing up macOS’ file directory and you may end up having to reinstall the operating system. The easiest way of all to fix problems associated with the iOS Simulator in Xcode is to use CleanMyMac X and delete the cache from there.

Thanks for reading and stay tuned!

These might also interest you:

Don't modify the Cleanup Script - things in /System are NOT guaranteed to not be deleted or changed by Software Update.

Iphone Sync music between your Mac and iPhone or iPad. You can sync all or a selection of your music on your Mac to your iPhone, iPad, or iPod touch. If you subscribe to Apple Music, your music is transferred automatically to all your devices and no syncing is required. No More iTunes. How to use Finder in macOS Catalina to Sync and Restore iPhone; Steps to copy music from Mac to iPhone, iPad, or iPod. Open iTunes (macOS Mojave and below) or Finder (macOS Catalina and above) on your MacBook; Connect your iPhone to your Mac using a USB/USB-C cable or with a previously established device WiFi connection. Launch iTunes and connect your iPhone to Mac. On iTunes, make sure you are in 'Music' library. Then click 'File Add File to Library' and locate your Mac music. Select the songs you wish to sync and press 'Open' to add them to iTunes music library. Jan 16, 2020  On your Mac Open the Apple Music app. From the menu bar at the top of your screen, choose Music Preferences. Go to the General tab and select Sync Library to turn it on. Feb 13, 2020  Are you looking for the method to transfer music from Mac to your iPhone X, iPhone 8, or iPhone 7? Read this blog post and you will get two easy ways to copy music from Mac to your iPhone effectively, either with or without iTunes.

Instead, make your own startup item in /Library/StartupItems

sudo mkdir /Library/StartupItems/CacheCleaner

You may have to create /Library/StartupItems - I don't remember if OS X ships with an empty one by default or not. If you do have to create it, remember that there is not a space between Startup and Items

Mac Library Caches Cleanup Windows 10

Create /Library/StartupItems/CacheCleaner/CacheCleaner with the following contents:

#!/bin/sh
. /etc/rc.common
##
# Start mail server
##
ConsoleMessage 'Cleaning System Cache Files'
rm -fr /System/Library/Caches/*
rm -fr /Library/Caches/*

Don't forget to chmod 755 /Library/StartupItems/CacheCleaner/CacheCleaner or the startup item won't load.

Now create /Library/StartupItems/CacheCleaner/StartupParameters.plist with the following contents:


{
Description = 'Cache Cleaner';
Provides = ('CleanCache');
Requires = ('Cleanup');
Uses = ('Cleanup');
Preference = 'None';
OrderPreference = 'Early';
Messages =
{
start = 'Cleaning System Cache Files';
stop = 'Cleaning System Cache Files';
};
}

Windows Store Cache Cleanup


Library caches folder


This way you don't have to worry about system updates (like Jaguar) trashing your startup item. The line Requires = ('Cleanup'); will tell OS X to run your startup item some time after the standard Cleanup startup item.

Now to clean your personal caches, you're better off using an applescript that launches during login.

Open Script Editor, and put the following lines into a new script:


do shell script 'rm -rf ~/Library/Preferences/Explorer/Download*Cache'
do shell script 'rm -rf ~/Library/Caches/*'
-- Uncomment the next line if you want to nuke your IE History as well
-- do shell script 'rm -rf ~/Library/Preferences/Explorer/History.html'

Save the script somewhere, then go into the Login pane of System Preferences and add the new script to your login items.

Mac Library Caches Cleanup Download

jpb