You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of having Xcode’s Derived Data be based in a spinning disk or solid-state drive, moving it to a RAM disk can make the performance of Xcode build operations *as fast as possible* and make it so that your Derived Data content is continually freshened.
3
+
Instead of having Xcode’s Derived Data based in a spinning disk or solid-state drive, move it to a RAM disk. Then, the performance of Xcode build operations run *as fast as possible.* A side benefit is the contents do not persist across reboots and, therefore, do not accumulate excessively.
4
4
5
-
I’ve crafted a script in Swift to perform the necessary configuration. I start the script in a launch agent that runs at startup so that my RAM disk is always available. Returning to a standard Xcode configuration simply requires ejecting the RAM disk.
5
+
I have crafted a script in Swift to perform the necessary configuration for you. It can automatically start using a launch agent at startup, so the RAM disk is always available. Returning to a standard Xcode configuration requires ejecting the RAM disk.
6
6
7
-
The reason this works is because the RAM disk is mounted to the default path for the DerivedData folder that Xcode uses. You can verify this path in Xcode under Locations in Preferences.
7
+
It works because the RAM disk mounts to the default path for the DerivedData folder that Xcode uses. You can verify this path in Xcode under Locations in Preferences. The RAM disk gets used by command-line builds and is thereby compatible with alternative IDEs such as AppCode.
8
8
9
9
## Installation
10
10
11
-
The install path is defined in the build settings under `INSTALL_DIR`. This is where the binary product will be copied every time the project is built. A default path of `$(HOME)/bin`has been set. This value is set by two settings in Xcode's build settings: `INSTALL_ROOT` and `INSTALL_PATH`.
11
+
Define the install path in the build settings under `INSTALL_DIR`. The binary product is copied to this location when building the project. A default path of `$(HOME)/bin`is set. Configuration of this value is by two settings in Xcode's build settings: `INSTALL_ROOT` and `INSTALL_PATH`.
12
12
13
-
**Therefore, the following steps should be completed to build and install the compiled version of the script.**
13
+
**Complete the following steps to build and install the compiled version of the script.**
14
14
15
15
* If needed, change the size of `RAMDISK_GB` in `main.swift`
16
-
* If needed, change the install path under Targets > SetupXcodeDerivedDataRamDisk > Build Settings > Installation Build Products Location + Installation Directory
16
+
* If needed, change the install path under Targets > SetupXcodeDerivedDataRamDisk > Build Settings > Installation Build Products Location + Installation Directory
17
17
* Build the project in Xcode
18
18
19
19
## Alternative installation
20
20
21
-
Copy `main.swift` to a local path of your choosing such as
21
+
Copy `main.swift` to a local path of your choosing, such as
22
22
23
-
~/bin/setupXcodeDerivedDataRAMDisk.swift
24
-
25
-
Make it executable using `chmod +x ~/bin/setupXcodeDerivedDataRAMDisk.swift`.
23
+
~/bin/setupXcodeDerivedDataRAMDisk.swift
24
+
25
+
Make it executable with
26
+
27
+
chmod +x ~/bin/setupXcodeDerivedDataRAMDisk.swift
26
28
27
29
## Run at startup
28
30
29
-
Create a file with the following content. **Edit it so that it fits your system. Replace ${INSERT_YOUR_USERNAME} with your username. Add `.swift` to the filename if using the text-based script.**
31
+
Create a file with the following content. **Edit it to fit your system. Replace ${INSERT_YOUR_USERNAME} with your username. Add `.swift` to the filename if using the text-based script.**
30
32
31
33
<?xml version=1.0 encoding=UTF-8?>
32
34
<!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
@@ -46,14 +48,14 @@ Create a file with the following content. **Edit it so that it fits your system.
46
48
</dict>
47
49
</plist>
48
50
49
-
Give it a name like `com.ikiApps.setupXcodeDerivedDataRamDisk.plist` and copy it to
51
+
Give it a name, for example, `com.ikiApps.setupXcodeDerivedDataRamDisk.plist`, and copy it to
52
+
53
+
~/Library/LaunchAgents
54
+
55
+
User readable is the minimum permission for the property list. That corresponds to a permission value of 0400 for chmod.
50
56
51
-
~/Library/LaunchAgents
52
-
53
-
The minimum permission for this property list launch agent file is that it is readable by you. That corresponds to a permission value of 0400 in chmod terms.
57
+
Make sure Xcode is not running, and manually test starting the agent with the following command:
If everything went well, the script will now run every time you login. You can see the mounted RAM disk in the Finder when it is available. It will also be available in the list of mounts using the `mount` or `df` command.
61
+
If everything went well, the script should now run every time you log in. You can see the mounted RAM disk in the Finder when it is available. It will also be available in the list of mounts using the `mount` or `df` command.
0 commit comments