____________________________
/ /\ ██╗ ██╗ ██████╗ ██╗ █████╗ ██╗ ██╗███╗ ██╗ ██████╗██╗ ██╗
/ _/ /\ ╚██╗██╔╝██╔════╝ ██║ ██╔══██╗██║ ██║████╗ ██║██╔════╝██║ ██║
/ xc-launch / \/ ╚███╔╝ ██║█████╗██║ ███████║██║ ██║██╔██╗ ██║██║ ███████║
/ /\ ██╔██╗ ██║╚════╝██║ ██╔══██║██║ ██║██║╚██╗██║██║ ██╔══██║
/___________________________/ / ██╔╝ ██╗╚██████╗ ███████╗██║ ██║╚██████╔╝██║ ╚████║╚██████╗██║ ██║
\___________________________\/ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ... your derived data folder in RAM
This is a small script to launch Xcode using a RAM disk to store intermediate build products files, normally found in DerivedData
.
After some time using Xcode, the DerivedData folder tends to grow. In my secondary development machine takes now 1.8 GB. Creating all these files in a RAM Disk destroys everything after switching off your machine (or ejecting the drive). Also, if you have enough memory, it speeds up compiling (everything happens in RAM)
This problem is shown here: https://twitter.com/mindbrix/status/412929707727159296
Also, in this StackOverflow discussion
- Just copy this script somewhere in your PATH, for instance to
/usr/local/bin
(using for examplecp xc-launch.sh /usr/local/bin
) - Grant it executable permissions:
chmod a+x xc-launch.sh
To make use of it, you need to change your Xcode preferences
- Go to Xcode > Preferences > Locations
- Point Derived Data to /Volumes/ramdisk
You don't need to be root to run this :-)
When you finish, eject your ramdisk using the Finder.
- macOS 10.9 - 10.12 - OK
- Xcode 6, 7, 8
Others: let me know, should work
I haven't timed it. Maybe using time
and xcodebuild
from command line with the same project, on average would be a good way to measure it.
But I use this script mainly because everything gets created in memory:
- less stress put on my SSD
- no GB lost somewhere else in my HD
Personally I use the terrific DTerm, with a shortcut of Cmd + Alt + Ctrl + T (for Terminal), then use autocomplete to launch xc-launch.sh
Distributed under the MIT & Anyone but Richard Stallman licenses ;-)
Copyright (c) 2013 Diego Freniche
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.