<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: João Victor Cabral</title>
    <description>The latest articles on DEV Community by João Victor Cabral (@cabraljv).</description>
    <link>https://dev.to/cabraljv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2424909%2Fc8c34437-15f3-493d-b682-cf5138200979.jpeg</url>
      <title>DEV Community: João Victor Cabral</title>
      <link>https://dev.to/cabraljv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cabraljv"/>
    <language>en</language>
    <item>
      <title>How to Build and Test iOS Applications on Windows/Linux Using Docker</title>
      <dc:creator>João Victor Cabral</dc:creator>
      <pubDate>Wed, 13 Nov 2024 12:40:03 +0000</pubDate>
      <link>https://dev.to/cabraljv/how-to-build-and-test-ios-applications-on-windowslinux-using-docker-4jfh</link>
      <guid>https://dev.to/cabraljv/how-to-build-and-test-ios-applications-on-windowslinux-using-docker-4jfh</guid>
      <description>&lt;p&gt;Building and testing iOS applications typically requires Xcode, which is only available on macOS. I faced this challenge myself a few years ago when I was studying mobile development and using Linux, without easy access to a Mac. At that time, I ended up giving up on the idea due to the difficulties. However, while recently browsing top repositories on GitHub, I came across an incredible project: a complete macOS Docker container with a graphical interface and a full macOS environment.&lt;/p&gt;

&lt;p&gt;This guide is based on the &lt;a href="https://github.com/dockur/macos" rel="noopener noreferrer"&gt;macos-dockur&lt;/a&gt; project and walks you through the process of building and testing iOS apps using Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;The easiest and most common way to manage this type of container—especially since you’re likely to use it multiple times—is by utilizing Docker Compose. This simplifies the process and allows you to specify everything you need, like volumes, environment variables, and ports, in one file.&lt;/p&gt;

&lt;p&gt;Here’s a sample docker-compose.yml file for this tutorial:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3'&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;macos&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dockurr/macos&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;VERSION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;15"&lt;/span&gt; &lt;span class="c1"&gt;# macOS version, we are using version 15 for better compatibility with Xcode&lt;/span&gt;
      &lt;span class="na"&gt;RAM_SIZE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8G"&lt;/span&gt; &lt;span class="c1"&gt;# Recommended RAM size is at least 8GB&lt;/span&gt;
      &lt;span class="na"&gt;CPU_CORES&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4"&lt;/span&gt;
    &lt;span class="na"&gt;devices&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/dev/kvm&lt;/span&gt;
    &lt;span class="na"&gt;cap_add&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;NET_ADMIN&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./storage:/storage&lt;/span&gt; &lt;span class="c1"&gt;# This folder will store your entire system&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;8006:8006&lt;/span&gt; &lt;span class="c1"&gt;# Access the graphical interface via this port&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;5900:5900/tcp&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;5900:5900/udp&lt;/span&gt;
    &lt;span class="na"&gt;stop_grace_period&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2m&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the Container
&lt;/h2&gt;

&lt;p&gt;To start the container, simply use a simple &lt;code&gt;docker-compose up&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once the container is running, you'll be able to access the macOS graphical interface by navigating to &lt;code&gt;http://localhost:8006&lt;/code&gt; in your browser after a few seconds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehflcyist14qtqa8basp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehflcyist14qtqa8basp.png" alt="appleos instaler" width="800" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing macOS
&lt;/h2&gt;

&lt;p&gt;When the download finishes, you’ll be prompted with the system installer. The first thing you’ll need to do is format the disk. Open Disk Utility, find the largest "Apple Inc..." disk, and click “Erase.” You can go with the default settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fd8q96kszowkyir128x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fd8q96kszowkyir128x.png" alt="Macos installer" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, close Disk Utility and click "Reinstall macOS." Follow the installer prompts, using the default settings. At the final step, do not log in with your Apple ID—this setup runs more smoothly without it. The installation process will take some time (in my case, around 30 minutes), so be patient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Xcode
&lt;/h2&gt;

&lt;p&gt;After the installation is complete, the first thing you’ll need to do is install Xcode. Since we don’t have access to the App Store with this setup, you’ll need to manually download Xcode from the &lt;a href="https://developer.apple.com/download/more/" rel="noopener noreferrer"&gt;Apple Developer&lt;/a&gt; website. Log in with your Apple ID in your browser and search for the Xcode version you want—in my case, I downloaded version 16.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg09jp36q7b9vsooivh2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg09jp36q7b9vsooivh2.png" alt="apple developers download page" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the download finishes, follow these steps to install Xcode, you can install it by extracting in into the Applications folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;Downloads
xip &lt;span class="nt"&gt;-x&lt;/span&gt; Xcode_16.xip
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;Xcode.app /Applications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Downloading the iOS Simulator
&lt;/h2&gt;

&lt;p&gt;After Xcode is successfully installed, you can open it and begin developing your iOS applications. You’ll be able to compile and test them using Xcode’s built-in simulator.&lt;/p&gt;

&lt;p&gt;To download the IOS simulator, you'll need to open xcode and select to create a new iOS project, click to download the iOS simulator in the current iOS version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczwmlx68u00a65ixty9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczwmlx68u00a65ixty9x.png" alt="xcode start page" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Running the Simulator
&lt;/h2&gt;

&lt;p&gt;After the download have been finished, you can open the simulator normally by going in the menu &lt;strong&gt;Xcode &amp;gt; Open Developer Tool &amp;gt; Simulator&lt;/strong&gt; and test whatever you want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbs2i1i6lgdknm3atpxb4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbs2i1i6lgdknm3atpxb4.png" alt="iphone simulator" width="800" height="884"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A Heads-up About Performance
&lt;/h2&gt;

&lt;p&gt;It’s important to mention that the Simulator will likely run waaaay slowly in this setup. While it may not be the fastest experience, for someone without access to a Mac, this method still provides a functional environment to develop and test iOS apps. It's not perfect, but it's definitely workable.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>ios</category>
      <category>reactnative</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
