<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Orhan Aykut Kardeş on Medium]]></title>
        <description><![CDATA[Stories by Orhan Aykut Kardeş on Medium]]></description>
        <link>https://medium.com/@aykutkardes?source=rss-1b6082ad2923------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xi2gWr_TTY4G4SYyzSimlA@2x.jpeg</url>
            <title>Stories by Orhan Aykut Kardeş on Medium</title>
            <link>https://medium.com/@aykutkardes?source=rss-1b6082ad2923------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:45:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aykutkardes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Fixing “figma couldn’t be imported because a plug-in with that name is already available” in Xcode…]]></title>
            <link>https://medium.com/@aykutkardes/fixing-figma-couldnt-be-imported-because-a-plug-in-with-that-name-is-already-available-in-xcode-323759b47c8e?source=rss-1b6082ad2923------2</link>
            <guid isPermaLink="false">https://medium.com/p/323759b47c8e</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[figma]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <dc:creator><![CDATA[Orhan Aykut Kardeş]]></dc:creator>
            <pubDate>Sun, 23 Aug 2026 00:33:02 GMT</pubDate>
            <atom:updated>2026-08-23T01:12:32.265Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fixing “figma couldn’t be imported because a plug-in with that name is already available” in Xcode 27 Beta</h3><p><em>A practical workaround for connecting Figma MCP to Claude Agent when Xcode’s Plug-in importer gets stuck.</em></p><figure><img alt="Xcode’s Plug-ins list showed no installed Figma entry, yet importing it failed because the name was supposedly already taken." src="https://cdn-images-1.medium.com/max/1024/1*_LytQcISfSc10Gu4qRjIKw.png" /><figcaption><em>Xcode’s Plug-ins list showed no installed Figma entry, yet importing it failed because the name was supposedly already taken.</em></figcaption></figure><p>Xcode 27 Beta can fail to import the Figma plug-in even when no Figma entry appears under <strong>Settings → Intelligence → Plug-ins</strong>. The importer reports:</p><blockquote>“figma” couldn’t be imported because a plug-in with that name is already available.</blockquote><p>This workaround bypasses the plug-in importer, connects the official Figma MCP endpoint directly to Xcode’s Claude Agent configuration, and completes OAuth using Xcode’s embedded Claude executable.</p><p>It restores access to the Figma MCP tools, although it may not make the Figma entry appear in Xcode’s Plug-ins interface or install every skill bundled with the full plug-in.</p><p>The same behavior has been reported by other Xcode 27 Beta users, but there is currently no published fix for the importer itself.</p><h3>First, confirm which Xcode is active</h3><p>Figma’s Xcode integration currently requires Xcode 27 Beta. Before continuing, confirm both the Xcode version and the developer directory selected for command-line tools:</p><pre>xcodebuild -version<br>xcode-select -p</pre><p>The output should identify Xcode 27 and point to the beta installation:</p><pre>Xcode 27.0<br>Build version &lt;current beta build&gt;<br>/Applications/Xcode-beta.app/Contents/Developer</pre><p>If the output still identifies a stable Xcode version or points to/Applications/Xcode.app, switch the active developer directory:</p><pre>sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer</pre><p>If your beta application uses a different filename or location, replace /Applications/Xcode-beta.app with its actual path.</p><p>Run the verification commands again after switching:</p><pre>xcodebuild -version<br>xcode-select -p</pre><p>Do not continue until both results point to Xcode 27 Beta. If the import error remains after this check, continue with the Claude Agent configuration below.</p><h3>Check Xcode’s Claude Agent configuration</h3><p>Xcode keeps Claude Agent’s state in its own configuration directory rather than automatically sharing the configuration used by a standalone Claude Code installation:</p><pre>~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig</pre><p>The relevant file is hidden:</p><pre>.claude.json</pre><p>Do not paste the complete contents of this file into an issue, forum post, or chat. It can contain machine and account-related metadata.</p><p>I inspected only the top-level field names and configured MCP server names:</p><pre>/usr/bin/python3 - &lt;&lt;&#39;PY&#39;<br>import json<br>from pathlib import Path</pre><pre>path = Path.home() / &quot;Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/.claude.json&quot;<br>data = json.loads(path.read_text())</pre><pre>print(&quot;Top-level fields:&quot;, sorted(data.keys()))<br>print(&quot;MCP servers:&quot;, sorted(data.get(&quot;mcpServers&quot;, {}).keys()))<br>PY</pre><p>The MCP server list was empty. This explained why Claude Agent could not expose any Figma tools, regardless of what the Plug-in importer believed was installed.</p><h3>Add Figma MCP without overwriting the existing configuration</h3><p>Quit Xcode completely before changing the configuration. Closing only the project window is not enough; use <strong>Xcode → Quit Xcode</strong> or ⌘Q.</p><p>The following script preserves the existing fields and adds a singlefigma entry:</p><pre>/usr/bin/python3 - &lt;&lt;&#39;PY&#39;<br>import json<br>from pathlib import Path</pre><pre>path = Path.home() / &quot;Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/.claude.json&quot;<br>data = json.loads(path.read_text())</pre><pre>servers = data.setdefault(&quot;mcpServers&quot;, {})<br>servers[&quot;figma&quot;] = {<br>    &quot;type&quot;: &quot;http&quot;,<br>    &quot;url&quot;: &quot;https://mcp.figma.com/mcp&quot;<br>}</pre><pre>path.write_text(json.dumps(data, indent=2, ensure_ascii=False) + &quot;\n&quot;)</pre><pre>print(&quot;Configured MCP servers:&quot;, sorted(data[&quot;mcpServers&quot;].keys()))<br>PY</pre><p>After reopening Xcode, Claude Agent could see that the server existed, but the Figma tools were still unavailable. Its response made the remaining issue clear: the server was connected but not authorized.</p><h3>Why the usual OAuth command may not work</h3><p>Recent Claude Code versions can start an MCP OAuth flow directly from Terminal:</p><pre>claude mcp login figma</pre><p>That only helps when the claude command is installed and when it is using the same configuration as Xcode. On my machine, there was no standalone Claude CLI:</p><pre>zsh: command not found: claude</pre><p>Installing another copy was not necessary. Xcode already ships the Claude executable used by its integrated agent. The important part was locating the executable that belongs to the active Xcode build and running it with Xcode’s own configuration directory.</p><h3>Use Xcode’s embedded Claude executable for OAuth</h3><p>With Xcode still closed, I used this script:</p><pre>XCODE_BUILD=&quot;$(xcodebuild -version | awk &#39;/Build version/{print $3}&#39;)&quot;</pre><pre>CLAUDE_BIN=&quot;$(find \<br>  &quot;$HOME/Library/Developer/Xcode/CodingAssistant/Agents/XcodeVersions/$XCODE_BUILD&quot; \<br>  -type f -name &quot;claude&quot; -perm -111 -print -quit 2&gt;/dev/null)&quot;</pre><pre>if [ -z &quot;$CLAUDE_BIN&quot; ]; then<br>  CLAUDE_BIN=&quot;$(find \<br>    &quot;$HOME/Library/Developer/Xcode/CodingAssistant/Agents&quot; \<br>    -type f -name &quot;claude&quot; -perm -111 -print -quit 2&gt;/dev/null)&quot;<br>fi</pre><pre>if [ -z &quot;$CLAUDE_BIN&quot; ]; then<br>  echo &quot;Xcode Claude executable was not found.&quot;<br>else<br>  echo &quot;Claude executable: $CLAUDE_BIN&quot;<br>  &quot;$CLAUDE_BIN&quot; --version</pre><pre>  CLAUDE_CONFIG_DIR=&quot;$HOME/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig&quot; \<br>    &quot;$CLAUDE_BIN&quot; mcp login figma<br>fi</pre><p>The browser opened the Figma authorization page. After signing in and allowing access, the terminal completed the OAuth flow against the same configuration directory that Xcode’s Claude Agent uses.</p><p>That CLAUDE_CONFIG_DIR assignment is the key detail. Without it, authentication may be stored in a separate Claude profile, leaving the Xcode agent connected but unauthorized.</p><h3>Verify the connection in Xcode</h3><p>Open Xcode 27 Beta again:</p><pre>open /Applications/Xcode-beta.app</pre><p>Start a new Claude Agent conversation and ask:</p><pre>Use the Figma MCP server and list the available Figma tools.</pre><p>The Figma tools should now be exposed to the agent. You can then test a real design request by pasting a link to a specific Figma frame or component and asking Claude to retrieve its design context.</p><h3>What this workaround actually fixes</h3><p>This approach bypasses the broken Plug-in import path. It configures and authorizes the remote Figma MCP server for Xcode’s Claude Agent, which restores access to Figma’s MCP tools.</p><p>It does <strong>not</strong> necessarily make the Figma entry appear in Xcode’s Plug-ins interface, and it does not guarantee that every skill bundled with the full Figma plug-in has been installed. The goal here is narrower: unblock structured access to Figma designs when the importer refuses to complete.</p><p>There are also two implementation details worth keeping in mind:</p><ul><li>Xcode’s embedded Claude executable path is not a public, stable API. A future Xcode beta may move it. The script searches by the active Xcode build first and falls back to the broader Agents directory for that reason.</li><li>Editing .claude.json manually should be done carefully. Preserve its existing fields and never replace the entire file with a minimal example copied from the internet.</li></ul><h3>Closing thoughts</h3><p>The misleading part of this bug is that three different states disagree with each other:</p><ol><li>Xcode’s Plug-ins screen says Figma is not installed.</li><li>The importer says a plug-in named figma already exists.</li><li>Claude Agent can connect to the manually configured server but cannot expose its tools until OAuth is completed in the correct configuration profile.</li></ol><p>Once those layers are treated separately, the workaround becomes fairly small: add the official Figma MCP endpoint to Xcode’s Claude configuration, locate Xcode’s own Claude executable, and run the MCP login with CLAUDE_CONFIG_DIR pointing to the Xcode profile.</p><p>It is not the polished one-click setup the integration is supposed to provide, but it gets Figma design context working without waiting for the beta importer to be fixed.</p><h3>References</h3><ul><li><a href="https://help.figma.com/hc/en-us/articles/41061095668759-Xcode-and-Figma-Set-up-the-MCP-server">Xcode and Figma: Set up the MCP server</a></li><li><a href="https://developers.figma.com/docs/figma-mcp-server/remote-server-installation/">Figma MCP remote server installation</a></li><li><a href="https://docs.anthropic.com/en/docs/claude-code/mcp">Claude Code: Connect to tools with MCP</a></li><li><a href="https://docs.anthropic.com/en/docs/claude-code/settings">Claude Code settings and </a><a href="https://docs.anthropic.com/en/docs/claude-code/settings">CLAUDE_CONFIG_DIR</a></li><li><a href="https://forum.figma.com/report-a-problem-6/figma-plugin-for-xcode-error-54821">Figma community report for the same Xcode import error</a></li></ul><p><em>Tested on Xcode 27 Beta 5 (27A5237l) on August 23, 2026. Xcode beta behavior and internal file locations may change in later builds.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=323759b47c8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memory Management in Swift: Strong, Weak, Unowned Relationships]]></title>
            <link>https://medium.com/@aykutkardes/memory-management-in-swift-strong-weak-unowned-relationships-a82ddad76f8e?source=rss-1b6082ad2923------2</link>
            <guid isPermaLink="false">https://medium.com/p/a82ddad76f8e</guid>
            <category><![CDATA[cars]]></category>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[reference-type]]></category>
            <dc:creator><![CDATA[Orhan Aykut Kardeş]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 21:55:03 GMT</pubDate>
            <atom:updated>2023-09-09T00:25:15.365Z</atom:updated>
            <content:encoded><![CDATA[<p>In software development, managing memory efficiently is key. In Swift, this is handled by ARC (Automatic Reference Counting). However, to truly tap into ARC’s potential, one must understand the roles of different reference types: strong, weak, and unowned. This article provides insight into these crucial concepts in Swift’s memory management.</p><p>More detailed explanations are included in the article related to <a href="https://medium.com/@aykutkardes/understanding-memory-management-arc-47cd16a0fa80">ARC</a>.</p><h4>Understanding Strong References in Swift</h4><p>In Swift, the default reference type is the strong reference. Managed by ARC (Automatic Reference Counting), it ensures an object stays in memory as long as there&#39;s a strong reference to it.</p><p><strong>Advantages of Strong References:</strong></p><ul><li><strong>Lifecycle Clarity:</strong> Dictates when an object should stay or be released.</li><li><strong>Simplicity:</strong> No extra keywords needed; it’s Swift’s default.</li></ul><p><strong>Disadvantages of Strong References:</strong></p><ul><li><strong>Retain Cycles:</strong> Two objects referencing each other can create memory leaks.</li></ul><p><strong>When Should We Use Strong References?</strong></p><ul><li><strong>Key Objects:</strong> Use when an object’s presence in memory is vital.</li><li><strong>Dependencies:</strong> When an object heavily relies on another.</li></ul><p>Imagine a User class with assigned Task objects:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbdcd3759d2ffe5988c4931249f2d472/href">https://medium.com/media/dbdcd3759d2ffe5988c4931249f2d472/href</a></iframe><p>Here, the User class&#39;s tasks hold strong references to the Task objects, ensuring both persist in memory together.</p><p>In conclusion, while strong references offer clear control in Swift, care is required to avoid pitfalls like retain cycles.</p><h4>Understanding Weak References in Swift</h4><p>weak references in Swift offer a way to reference an object without incrementing its reference count. Their main advantage is automatically becoming nil when the referenced object is deallocated, making them useful in preventing retain cycles.</p><p><strong>Benefits of Using Weak References:</strong></p><ul><li><strong>Avoiding Retain Cycles:</strong> weak references help in breaking circular links between objects.</li><li><strong>Automatic Nil Assignment:</strong> They turn to nil when the object they point to is no longer in memory, ensuring safety.</li></ul><p><strong>When Should We Use Weak References?</strong></p><ul><li><strong>Delegate Patterns:</strong> Often used when one class delegates a task to another, avoiding strong circular links.</li><li><strong>Back References:</strong> In parent-child relationships, a back reference is typically weak to prevent strong ties.</li></ul><p>Imagine a Person class with an associated Pet. The Pet has a back reference to its Person:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbcc094614dfe09abfe335c88e7912ce/href">https://medium.com/media/cbcc094614dfe09abfe335c88e7912ce/href</a></iframe><p>Here, the owner in Pet is a weak reference, ensuring it becomes nil if its associated Person is deallocated.</p><p>In conclusion, weak references are invaluable in Swift for safer memory management, especially in delegate scenarios and back references.</p><h4>Understanding Unowned References in Swift</h4><p>Like weak references, unowned references point to an object without increasing its reference count. Yet, there are two main distinctions:</p><ol><li>unowned references must always have a non-nil value.</li><li>Accessing an unowned reference after its object has been deallocated causes an immediate crash.</li></ol><p><strong>Why to be Cautious with Unowned?</strong></p><ul><li><strong>Error-prone:</strong> Accidentally removing the referenced object and then accessing the unowned reference can lead to crashes, especially problematic in complex projects.</li><li><strong>Potential Memory Safety Issues:</strong> Unlike weak references that automatically turn to nil, unowned is riskier if misused.</li></ul><p><strong>When Should We Use </strong>Unowned<strong> References?</strong></p><ul><li><strong>Tightly Coupled Lifecycles:</strong> If two objects’ lifespans are intricately linked and it makes no sense for one to exist without the other.</li><li><strong>Absolute Non-nil Guarantee:</strong> Only if you’re 100% certain the reference will never become nil.</li></ul><p>Consider a Person class with an associated CreditCard. The credit card shouldn&#39;t exist without its person:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1d77ac91195c9b1a09c9ddd5d808a8a/href">https://medium.com/media/c1d77ac91195c9b1a09c9ddd5d808a8a/href</a></iframe><p>Here, the CreditCard class holds an unowned reference to a Person. Accessing the card after the person is deallocated will cause a crash.</p><p>In conclusion, while unowned references can be useful in specific scenarios, they come with their risks. Generally, weak references are deemed safer due to their ability to become nil. Nonetheless, with proper usage, unowned can serve its purpose effectively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a82ddad76f8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memory Management in Swift: ARC]]></title>
            <link>https://medium.com/@aykutkardes/understanding-memory-management-arc-47cd16a0fa80?source=rss-1b6082ad2923------2</link>
            <guid isPermaLink="false">https://medium.com/p/47cd16a0fa80</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Orhan Aykut Kardeş]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 21:35:35 GMT</pubDate>
            <atom:updated>2023-09-08T23:46:23.176Z</atom:updated>
            <content:encoded><![CDATA[<p>The deallocation of an object, whether it’s a <strong>class</strong>, <strong>structure</strong>, or <strong>enumeration</strong> is critical to ensure optimal performance and efficiency of the system by freeing up the memory occupied by the object when it is no longer needed. Properties, constants, and variables can maintain a reference to same class instance since class instances are passed by reference.</p><p><strong>ARC</strong> is based on a simple idea of monitoring class instances and determining the appropriate time to deallocate them by counting their references.</p><p>Let’s explain this with an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*OkuRKYnHv2okxj81aq3h2g.png" /></figure><p>This defines a class Client which has print statements to show when you have initialized or deallocated it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*haK3Xp-3RJpjxLM6qD15Tw.png" /></figure><p>The console log confirm that the Client object was initialized and the fact that the deinit method’s print statement was not executed that the object was not deallocated, because it has not yet gone out of scope. So, created object is never removed from memory.</p><p>Enclosing the client instance within a method will enable it to go out of scope, allowing <strong>ARC</strong> to deallocate the object.</p><p>The scope of the client instance is established by the registerClient() function. Once this scope is exited, the Client object is expected to be deallocated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*t8s5n5sgSIU1cECvl1w81Q.png" /></figure><p>The initialization and deallocation print statements both appear. These statements show that you’ve deallocated the object at the end of the scope.</p><p>In registerClient(), first, a Client object is created, then its reference is copied, and finally, its destination is updated.</p><p>In order to automatically manage the memory of the Client object, the Swift compiler inserts:</p><ul><li>a retain operation when a reference begins.</li><li>a release operation after the last use of the reference.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0SfYV_Us3KYfAZ6VB_A7Q.png" /></figure><p>Let’s take a look at the code and see what happens when it runs:</p><ul><li>Client object is created on the heap and given a reference count of <strong>1</strong>.</li><li>retain operation<em> </em>(added by the compiler) executes in preparation for the new client2 reference, increasing the reference count to <strong>2</strong>.</li><li>release operation is executed after the last use of the client1 reference, decrementing the reference count to <strong>1</strong>.</li><li>After the last use of reference client2 <strong>,</strong> a release operation is performed and the reference count is<strong> </strong>decremented to <strong>0.</strong></li></ul><h4>But Reference checking needs your assistance.</h4><p>In order to prevent memory leaks and retain cycles, <strong>Automatic Reference Counting (ARC)</strong> requires some assistance from you. In the upcoming series, we will focus specifically on <strong>retain cycles</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47cd16a0fa80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding and Fast Way to Reduce Xcode Space]]></title>
            <link>https://medium.com/@aykutkardes/understanding-and-fast-way-to-reduce-xcode-space-75e07acf6b1e?source=rss-1b6082ad2923------2</link>
            <guid isPermaLink="false">https://medium.com/p/75e07acf6b1e</guid>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[derived-data]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[Orhan Aykut Kardeş]]></dc:creator>
            <pubDate>Thu, 02 Mar 2023 21:16:39 GMT</pubDate>
            <atom:updated>2023-03-17T07:29:02.715Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*eY5vwXeM-DHKj9bceTLd8A@2x.jpeg" /></figure><p>Xcode is more than a basic text editor and is actually a fully-featured Integrated Development Environment (IDE) for iOS development. This means that it offers numerous benefits, including easy project building, debugging and code-signing. Xcode can consume a significant amount of storage space on your Mac. In fact, a new installation of Xcode takes up around 12 gigabytes of storage space. Yet, this is only the tip of the iceberg since Xcode is well-known for its tendency to take up a considerable amount of storage space despite its many benefits.</p><p>As time passes, Xcode’s storage footprint increases as a result of certain tools and directories it contains.</p><ul><li>Derived data</li><li>Caches</li><li>Archives</li><li>Unavailable simulators</li><li>Device support files</li></ul><p>In addition to taking up a significant amount of storage space on your Mac, the saved data generated by Xcode can also cause issues such as strange bugs and compilation problems. In the event that you experience unusual behavior while constructing an application, removing directories such as derived data and caches could potentially rectify the problem and bring back normal operation.</p><h3>Understanding Derived Data</h3><p>In the context of Xcode, derived data refers to the build output generated by the compiler and other build tools when building a project or workspace.</p><p>When you build a project in Xcode, the build output is placed in a directory known as the DerivedData directory. This directory contains intermediate build files, as well as the final build output, such as the executable, libraries, and other files generated during the build process.</p><p>Derived data in Xcode is used to speed up the build process by allowing Xcode to reuse previously compiled files and only recompile the parts of the code that have changed since the last build. This can significantly reduce the time it takes to build a project, especially for large projects with many files.</p><p>You can view and manage the derived data directory in Xcode preferences, where you can change its location, clear its contents, or disable it entirely.</p><p>Here, type the location of your derived data folder:</p><pre>~/Library/Developer/Xcode/DerivedData</pre><p>Deleting derived data in Xcode will remove all the intermediate build files and other build outputs that were generated during the build process. This can free up a significant amount of disk space on your computer.</p><p>When you delete derived data, Xcode will need to rebuild your project from scratch the next time you build it. This means that Xcode will have to compile all the files in your project again, which can take longer than a subsequent build that reuses the previously compiled files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*ytza21_D5l1muL3yzu1xmQ.png" /></figure><p>Your derived data contains a <strong>ModuleCache.noindex</strong> folder as well as folders for any projects you’ve built in Xcode.</p><p><strong>ModuleCache.noindex </strong>is a location where Xcode saves previously compiled modules. These cached modules are shared by Xcode across various projects and builds in order to expedite the build process.</p><h3>Deleting previously created archives</h3><p>When you create an archive of an application for distribution on TestFlight or the App Store, the archive is saved on your Mac’s local storage. You may have archives that are several years old and need to be deleted. In this part of the process, delete the archive to free up significant storage space on your Mac.</p><pre>~/Library/Developer/Xcode/Archives</pre><p>Your archives are different from derived data in that they don’t affect future builds and don’t make the compilation faster. They are the final output of building the app. However, you shouldn’t delete old archives when you run out of space because you may need them in the future if you want to re-release an old version of the app. Additionally, if you want to debug a live version of the app, you need a file called dSYM, which is included in the archive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*4k1elWv4Mrg_vVqeVLjpqQ.png" /></figure><blockquote><em>It is recommended that you avoid deleting any archives of the app versions that are currently available or older archives that you may want to use later.</em></blockquote><h3>Clearing Simulators</h3><p>When you install a project on a simulator, it occupies some space on your computer. It can also store images in the Photos library of the simulator, which uses additional space.</p><p>If you want to test the app as a new user, it’s helpful to start with a clean simulator. Therefore, deleting data from the simulators can keep your Mac running smoothly.</p><p>When you delete an app from an iPhone, it doesn’t necessarily mean that all the data associated with that app, such as files, photos, contacts, or Core Data databases, are also deleted. To completely remove all the data, including those stored in other locations, you will have to erase the content of the simulator.</p><h3>Caches</h3><p>Caches are used to store data so that programs utilizing the cache can operate more quickly, without having to recompute the cached data.</p><p>Caches are designed to be temporary, meaning that the data they contain are not meant to be permanent. Removing cached data is harmless since the program that created the cache can recreate it whenever necessary. However, when dealing with larger caches, there may be a delay as the cache rebuilds itself. Clearing caches is a commonly used method to free up space. For instance, when the cache for Xcode is deleted, any outdated or unused data will be removed permanently. Xcode has the ability to regenerate anything that is still necessary at a later time.</p><p>Clearing caches can also help to resolve issues with Xcode or its associated tools.</p><p>Carthage and CocoaPods are two other caches that are noteworthy because they are dependency managers that assist with managing third-party libraries that you may have integrated into your apps.</p><blockquote><em>If you utilize Carthage, you can locate its cache at the following directory: </em><strong><em>~/Library/Caches/org.carthage.CarthageKit</em></strong><em>. On the other hand, CocoaPods has a specific command that can be used to clear its cache.</em></blockquote><p>To clear the CocoaPods cache, execute the following command in the terminal:</p><pre>pod cache clean --all</pre><blockquote><em>Using the dedicated cache clean command is more effective than deleting a folder manually. This is because if the storage location of CocoaPods cache changes, the command will still work for the new location. This is advantageous if you intend to create a script to delete your caches.</em></blockquote><h3>Let’s save time!</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eecba63522537abc2a07335954ebd4e8/href">https://medium.com/media/eecba63522537abc2a07335954ebd4e8/href</a></iframe><p>The file starts with a <strong>shebang</strong> which instructs the computer on how to run the script and must always be the first line. The remaining content of the file is a culmination of everything you have learned so far.</p><p>The following steps occur in sequence:</p><ol><li>Use the “echo” command to print a message to the terminal, providing information on the status of the script execution. Following that, the “rm” command is used to remove the derived data folder.</li><li>After printing another status update, the script deletes each folder associated with device support. If these folders are not present, no action is taken.</li><li>Delete unavailable simulators.</li><li>Delete the caches for Xcode and Carthage, if they exist.</li><li>Verify whether CocoaPods is installed on this computer.</li><li>If CocoaPods is present, proceed to clear the CocoaPods cache.</li></ol><h4>Creating a Script</h4><p>First, open a Terminal window. Run this command:</p><pre>cd ~/Documents &amp;&amp; touch clean-xcode.sh</pre><p>This command modifies the terminal window’s directory to your Documents folder. Subsequently, it generates a new, empty script.</p><h4>Running the Script</h4><p>If you try to run <strong>clean-xcode.sh</strong> as-is, you’ll get <strong>“Permission denied”</strong> error.</p><p>This is because the computer perceives it as a text file rather than something executable, such as a script or program. To transform it into an executable file, you must execute a command in the Terminal.</p><p>To achieve this, run the following command in your Terminal window:</p><pre>chmod u+x clean-xcode.sh</pre><p>Now, your computer will recognize <strong>clean-xcode.sh</strong> as an executable script.</p><p>Finally, you can run <strong>clean-xcode.sh</strong> by specifying its path in the terminal:</p><pre>./clean-xcode.sh</pre><p>You have effectively freed up storage space that gets accumulated by Xcode over time by running a single command. Done!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75e07acf6b1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>