With the upgrade version of Xcode,speedMore slowly,In particular, Yiyanbuge "Whiteboard"I believe we will have problems encountered。
This is the very thing affecting development efficiency。If it is possible,Then we will Xcode cache file into memory,It should be much faster speed。(Although rmbp of ssd have a very fast,But compared to memory,Or far worse -For older machines for mechanical hard drives,Speed will be more apparent。)
- Remember the RamDisk Windows do? In fact, there are Linux,And does not require third-party software,A built-in command can be done!
Our goal is to set aside part of the space from memory,Formatting a hard disk mounted to it which system,Designed to put the cache!
Must pay attention to
Since it is a memory,So be sure to shut contentLoseof,So we just use it to storeCan regenerateCache,They can then download the content should not be placed inside。For example, in the helpd OS X Help files downloaded,Should not be placed inside。
Your memory is how much total space,Volume of hard disk memory allocation size should be changed accordingly,After all, the memory of a fixed planning to go,For example, I used here is 1GB,So my original 8GB memory size becomes 7GB。
DIY
Open the OS X built-in script editor ,Create a new document,Other default,Then write in it:
1 2 3 4 5 6 7 8 9 |
do shell script " if ! test -e /Volumes/\"Ramdisk\" ; then diskutil erasevolume APFS \"RamDisk\" `hdiutil attach -nomount ram://2097152` fi mkdir -p /Volumes/Ramdisk/Library/Developer/Xcode mkdir -p /Volumes/Ramdisk/Library/Caches/Google mkdir -p /Volumes/Ramdisk/Library/Caches/com.apple.Safari/fsCachedData " |
- 2048 1MB
- 2097152 1GB
- 4194304 2GB
- 8388608 4GB
Then save it as a .appFormat:
Double-click execution can automatically mount called "RamDisk" of the hard disk,The hard drive contents will be cleared after the computer reboot,Size is 1GB,If you put it launched,So things will be lost inside,So be sure to store cache files。
After generating,We have to replace the cache over other applications,Xcode for it,You can directly within the application,But here we use a unified alternative ways catalog,Some benefits are not supported configurations such as Safari ,We can also manually put it into memory cache directory replacement,Transparent to the application。
Here we replace three applications,First, they quit:Safari Chrome Xcode
Then delete the cache directory applications:
1 2 3 4 5 |
sudo rm -rf ~/Library/Developer/Xcode/DerivedData sudo rm -rf ~/Library/Caches/com.apple.Safari sudo rm -rf ~/Library/Caches/Google |
These are the files in the directory can be deleted at any time,You will be automatically re-establish open,Your data will be lost。
Then according to our well-established catalog in memory hard drive to create a directory link,Just like in Windows shortcuts,But much more useful than that:
1 2 3 4 5 |
ln -s /Volumes/RamDisk/Library/Developer/Xcode ~/Library/Developer/Xcode/DerivedData ln -s /Volumes/RamDisk/Library/Caches/com.apple.Safari ~/Library/Caches/com.apple.Safari ln -s /Volumes/RamDisk/Library/Caches/Google ~/Library/Caches/Google |
This directory is replaced by a set of permanent,so,We should also make this memory hard drive mounted automatically at boot time,Then only need to "System Preferences"among-"Users & Groups”-“Log Optionsapp files created before "was added to。
Delete and restore
If you want to delete the entire program,You only need to go to the following link directory to delete files created,Then remove the startup items like scripts:
1 2 3 4 5 |
sudo rm -rf ~/Library/Developer/Xcode/DerivedData sudo rm -rf ~/Library/Caches/com.apple.Safari sudo rm -rf ~/Library/Caches/Google |
Performance and results
If you just do a general Xcode development,So 1GB of space should be sufficient to use the,As a result of the speed will be much faster Xcode,No longer so easy to whiteboard。Other,For Chrome and Safari effect is very obvious。
If you're like me to switch back and forth more often use Xcode development projects and compile,You may experience space stuffed,At this time you should pay attention to this "memory disk" will not release their own space,So to go in manually delete the cache files generated about Xcode,Then compile。
On the bright side,Even regenerate the cache file,Speed is still faster than the solid,Will not reduce the life of the hard disk read and write。
Further reading
How to make Xcode speed read and write 100 times on?
Open native Mac OS X comes with virtual memory disk (Ramdisk)
Original article written by LogStudio:R0uter's Blog » OS X open RamDisk to accelerate as Safari and Xcode
Reproduced Please keep the source and description link:https://www.logcg.com/archives/2725.html
This is not working anymore since sandboxing around Safari now even blocks symlinks to different Volumes like the Ramdisk.
Some Japanese created a script that mounted the Ramdisk directly at the folder of the Cache to get it working.
https://sakura.lazycat.info/archives/1018.html
Thanks for the heads-up man.
You can not open the application "disk.app",Because this type of Mac does not support the application。
macOS Sierra 10.12.4
Select Save type is application,We can not save the renamed again。
Excuse me, May follow suit and produce ramdisk browser with cache folder, While deleting the hard disk cache folder, But after the actual opening browser, But it is simultaneously written to the hard disk and Ramdisk same data, Hard disk equal to or written to be used as cache, Why not just have information ramdisk fishes?
macOS 10.12.4
You can’t open the application “RamDisk.app” because it is not supported on this type of Mac.
How do you do it,me too 10.12.4,no problem。Save time for the selected application,Can not be directly renamed。