Building Mac Os Apps Using Swift

Building Mac Os Apps Using Swift Average ratng: 3,6/5 6043 reviews

How can you run Xcode on Windows and develop iOS apps with a Windows PC? The short answer is: you can’t! You’ve got a few alternatives to get around that, however. In this tutorial, we’ll discuss how you can install Xcode on Windows to build iOS apps.

App Development with Swift 4.2 is a 5-day, hands-on course that is a combination of the Introduction to Swift 4.2 course and the Introduction to the iOS 12 SDK course. Introduction to Swift 4.2 From Playgrounds to protocols—discover, explore, and demonstrate how to use the fundamental building blocks of the Swift programming language.

Here’s what we’ll get into:

  • Rent a Mac in the cloud (starting at $20/mo)
  • Run and compile Swift directly on Windows/Linux
  • Learning to code with a Swift Sandbox
  • Build your own “Hackintosh” by installing macOS on a PC
  • Run Xcode on Windows by installing macOS on a virtual machine
  • Develop iOS apps on Windows with cross-platform tools
  • Get your hands on a second-hand Mac (starting at $300)

Let’s get to it!

Xcode for Windows: What & Why

Xcode is the macOS-only software program, called an IDE, that you use to design, develop and publish iOS apps. The Xcode IDE includes Swift, a code editor, Interface Builder, a debugger, documentation, version control, tools to publish your app in the App Store, and much more.

Xcode contains everything you need to build iOS apps, and it only runs on macOS!

That’s when the problems start. You want to make an iOS app with your Windows PC, but you can’t buy a PC or laptop with macOS pre-installed on it. Unlike Windows, Apple doesn’t license its operating system to other computer manufacturers. You can only use macOS on a Mac.

In fact, when you obtain a license to use macOS, which happens when you purchase a Mac computer, you have to agree to only run the operating system on Apple hardware. This effectively limits you to only develop apps on a Mac.

“It’s more fun to be a pirate than to join the navy.”
— Steve Jobs (1983)

But… it’s more fun to be a pirate, than to join the navy, right? Let’s discuss a few alternatives that’ll let you run Xcode on Windows and develop iOS apps on a Windows PC!

Rent a Mac in the Cloud

An even easier way to get your hands on macOS, albeit more expensive, is to rent a Mac “in the Cloud”. You can work with Xcode on Windows with this approach, because you’re essentially connected to a Mac that’s elsewhere.

Here’s how that works:

  • Someone connects a bunch of Mac’s to the internet
  • You sign in on one of those Macs via a Remote Desktop Connection (RDP)
  • Done! You can use this Mac from Windows/Linux and build iOS apps

Services like MacinCloud and MacStadium offer affordable rent-a-Mac products, usually paid on a monthly basis. Prices typically start at $20/month and you can choose from several hardware options, including Mac Mini and Mac Pro.

Starting atType
MacinCloud$20/monthDedicated, Virtual, Server
MacStadium$79/monthDedicated, Enterprise
virtualmacosx.com$9.75/monthShared (timesharing)
Mac Cloud$49/monthVirtual
FlowPremiumDedicated, Enterprise
HostMyApple$25/monthVirtual, Dedicated

You connect to those cloud-based Macs via a Remote Desktop Connection (RDP). Windows includes a stock Remote Desktop Client you can use, and so do most Linux operating systems. Once you’re logged on, you can launch Xcode, and start building your iOS app. That way you’re effectively running Xcode on your Windows PC!

Cloud-based Macs usually come in 3 flavours:

  • A dedicated Mac, which means you get access to a physical Mac located in a data center, as if you bought a Mac in the Apple Store and put it on your desk.
  • A virtual Mac, which means you get access to a virtual Mac in a data center, much like the VirtualBox solution mentioned earlier. Your Mac won’t run on Apple hardware, but it will run macOS.
  • A Mac Build Server, which is a specialized kind of Mac that can be used to compile iOS apps. You’ll create those apps on your Mac, and then instruct the Build Server to compile the app for you.

A dedicated Mac is the most convenient, and the most powerful option. A virtual Mac is OK too, but it typically does not perform as well as a physical Mac computer.

Running Xcode via a Mac in the cloud has a drawback: you can’t easily connect your iPhone to Xcode via USB! With Xcode on your local Mac you can run and debug your app on your own iPhone, via the USB/Lightning cable. This obviously won’t work when your Mac is in the cloud…

Don’t worry! There are plenty of solutions for that:

  • A simple approach is to run your app on iPhone Simulator, right from within Xcode. You can launch iPhone Simulator in Xcode, and debug your app with it. This is perfect for the development phase of your project.
  • An alternative solution are tools like Flexihub, NoMachine and USB Network Gate. They only work with dedicated Mac hardware, and you need to have a dedicated IP address.
  • Install your iOS app on your iPhone via TestFlight, and debug it with a tool like Bugsnag. You can monitor and debug live crashes in your app.

An interesting use case for renting a Mac in the cloud comes from the latest developments in Apple’s hardware. Many designers, developers and desktop-publishers have voiced their concerns over Apple hardware lagging behind, offering low-spec computers for a fairly high price.

If you don’t want to take your $3.000 MacBook Pro with you in a coffee shop, or on your next trip to Thailand, why not purchase a low-end Windows or Linux laptop, and connect to your Mac in the cloud? You can either host it at home yourself, co-locate it in a data center, or rent a dedicated cloud-based Mac.

Do you want to learn how to code iOS apps, but don’t want to invest money in a Mac? Rent a Mac in the cloud for the duration of the iOS development course you’re taking! It’s a great way to bootstrap learning iOS development, and you can always buy your own Mac later.

Learn how to code iOS apps

Get started with Xcode and Swift

Ready to get started with iOS development? Learn how to code iOS apps with Xcode and Swift with our immersive iOS development course. Works both on Mac and PC!

Install macOS on Your Windows PC via VirtualBox

The easiest way to run Xcode on Windows is by using a virtual machine (VM).

A virtual machine will create an environment an operating system can run in, as if it’s running on the hardware itself, except it’s running “on top” of your actual hardware and operating system. You can then run Xcode normally, because it essentially runs on macOS on Windows!

This is called virtualization, and it allows you to run Windows on Linux, macOS on Windows, and even Windows on macOS. One of the benefits of virtualization is to run multiple OS side-by-side, which is useful for cross-platform development.

You need 2 things to run macOS on Windows in a VM:

  1. A copy of macOS, as an installer or virtual disk image file
  2. A virtual machine tool, like VirtualBox (free) or VMware (paid)

You can obtain a copy of macOS by downloading it from the App Store or by borrowing it from a friend. A great approach is to search for virtual disk images that have macOS pre-installed. You can also find installers from various sources on the internet, or upgrade a pre-existing image to a newer (beta) version of macOS.

Here’s what you do next:

  1. Install VirtualBox or VMware
  2. Mount the macOS installer or disk image
  3. Start the VM to launch macOS
  4. Launch Xcode!

You can read exactly how to in this tutorial. The recommended system specs are: 4-8 GB of RAM, an Intel i5/i7 compatible CPU, and at least 10 GB of free disk space.

Note: Using macOS on non-Apple hardware is against Apple’s End User License Agreement (EULA). (Fun fact: the same EULA prohibits the use of macOS to manufacture missiles or nuclear weapons…)

Build Your Own “Hackintosh” to Run Xcode

Building Mac Os Apps Using Swift 2017

The most obvious choice to run Xcode on a Windows PC is perhaps to literally install macOS on a Windows PC…

“One platform to rule them all” has always been Apple’s take on the world. The Mac, App Store, iOS and Apple Music are all closed systems. Apple enthusiasts have always enjoyed the integrated Apple experience.

On the other hand, the rest of the world builds computers using an “open systems architecture”, in which you can effectively mix-and-match computer components and architectures to create your preferred computing machine.

Building $10.000 gaming PCs, mid-level desktops, blazing-fast ultrabooks, and $250 laptops is only possible because of open hardware. Because of Apple’s closed systems, you’re always bound by the hardware options they give you.

But… what if you want to run macOS on your custom built PC? Apple won’t let you, and your computer manufacturer can’t install macOS for you, even if they wanted to. Because macOS shall only run on Apple hardware!

Enter the “Hackintosh”.

A Hackintosh is a PC that runs macOS. Just like you can install macOS in a virtual machine, or in the cloud, you can install macOS as the bootable operating system on your PC. Switch it on, and macOS loads.

You can also create a dual-boot, i.e. a system that both hosts Windows and macOS. When you boot your PC, you can select the operating system that starts.

Building a Hackintosh can be a tricky exercise, especially if you’re not familiar with PC hardware and creating custom installations. Not all hardware is compatible with macOS. Moreover, Apple has of course created safe-guards against booting macOS on unsupported hardware.

Nevertheless, it’s a good option for running macOS on your custom hardware, and booting macOS on your Windows PC. Check out hackintosh.com for more information, and step-by-step guides.

The name “Hackintosh” comes from the old brand-name of Apple computers: Macintosh, combined with “hack”. Again, it’s against Apple’s EULA – but you wanted to be a pirate, right?

The days of the Hackintosh are almost over, depending on who you ask. Apple’s newer hardware includes a T2 chip now. Hardware-specific chips are notoriously hard to mimic in non-Apple hardware, which essentially means that, in the future, you may not be able to install or update macOS on a computer that doesn’t have that T2 chip.

Swift for Windows & Linux

Developers who want to learn Swift have 2 alternative approaches to code Swift, next to working with Xcode on Windows. Swift is open source, which means you can essentially run it on any system.

Currently, you can use:

  1. Swift 5 on Ubuntu Linux 16.04 and 18.04 via the official images
  2. Swift 4.1 on Windows 10 via the unofficial swiftforwindows.github.io

Here’s how you can run Swift code on Linux:

  1. Download the latest release from swift.org/download
  2. Unzip the .zip in a convenient location
  3. Locate the swift executable in the usr/bin directory
  4. Compile and run a Swift file with swift [filename.swift]

You can also copy the Swift executables to your $PATH, or add Swift’s folder to $PATH, to use the swift command anywhere on your system.

Here’s how you can run Swift code on Windows:

  1. Download the latest release of Swift for Windows from this page
  2. Start the program and point it to your .swift file
  3. Click Run in the program

It appears the Swift for Windows project hasn’t been updated in a while. It’s latest supported version is Swift 4.1., which doesn’t differ that much from Swift 5 in terms of beginner syntax and functionality. Your mileage may vary, though!

You can even run and compile Swift on the $35 Raspberry Pi single-board computer! You can download Swift 5, which has been ported to the ARM CPU architecture, right here. Installing is as easy as pointing your RPi to the swift-arm repo, then do sudo apt-get install swift5, and then run the Swift CLI with swift [filename.swift]. Neat!

Develop iOS Apps on Windows With Cross-Platform Tools

Cross-platform tools are awesome: you code your app once, and export it to iOS and Android. That could potentially cut your app development time and cost in half. Several cross-platform tools allow you to develop iOS apps on a Windows PC, or allow you to compile the app if there’s a Mac in your local network.

Well, not so fast…

The cross-platform tool ecosystem is very large. On the one side you have complete Integrated Development Environments (IDEs) like Xamarin, that allow you to build cross-platform apps with C#.

The middle ground is covered by tools like PhoneGap, Cordova, Ionic and Appcelerator, that let you build native apps with HTML5 components. The far end includes smaller platforms like React Native that allow you to write native apps with a JavaScript wrapper.

The one thing that stands out for all cross-platform tools is this: they’re not beginner friendly! It’s much easier to get access to a Mac, learn Swift, and build a simple app, than it is to get started with Xamarin.

Most of the cross-platform tools require you to have a basic understanding of programming, compilation options, and the iOS and Android ecosystems. That’s something you don’t really have as a beginner developer!

Having said that, let’s look at a couple of options:

  • If you’re familiar with Windows-based development tools and IDEs, and if you already know how to code, it’s worthwhile to check out Xamarin. With Xamarin you code apps in C#, for multiple platforms, using the Mono and MonoTouch frameworks.
  • If you’re familiar with web-based development, check out PhoneGap or Ionic. You’ll feel right at home with HTML 5, CSS and JavaScript. Don’t forget: a native app works different than a website…
  • If you’re familiar with JavaScript, or if you’d rather learn to code JavaScript than Swift, check out React Native. With React Native you can code native apps for iOS and Android using a “wrapper”.

Choose deliberately for a cross-platform tool because it fits your project, not because you think a native platform language is bad. The fact that one option isn’t right, doesn’t immediately make another option better!

If you don’t want to join the proprietary closed Apple universe, don’t forget that many cross-platform tools are operated by equally monopolistic companies like Google, Facebook, Microsoft, Adobe and Amazon.

An often heard argument against cross-platform tools is that they offer limited access to and support for smartphone hardware, and are less “snappy” than their native counterparts. Also, any cross-platform tool will require you to write platform-specific code at one point, especially if you want to code custom features.

Note: You’ll still need to compile your app with Xcode, even if you use cross-platform tools. Most cross-platform tools rely on the command-line tools that are shipped with Xcode, as part of macOS. You’ll also need Xcode to publish your app in the App Store.

Get a Second-Hand Mac

You gotta ask yourself: Why not get a Mac? Perhaps the simplest option to build iOS apps with Xcode, in this tutorial, is purchasing a Mac for iOS development.

If you don’t want to tinker with cross-platform tools, or rent-a-Mac in the cloud, and just want to get started with iOS development: get a Mac.

A simple search on Ebay shows you 1-3 year old second-hand Mac Mini’s for as little as $250. Any newer, decent second-hand Mac Mini will set you back around $450. Don’t forget that you can get a brand new Mac Mini for around $800.

A better question is perhaps: is a Mac Mini from 2015 fast enough to build apps with? I’ve built 50+ apps for iOS, Android and the web since 2009, and a fair share of those were built on a 1.2 Ghz 8GB MacBook Air from 2013. I started LearnAppMaking.com with that same trusty ol’ MacBook, and I’ve coded several successful production apps with it until 2018.

It’s traveled with me all over the world, from the beaches of Thailand, to airline lounges, to coffee shops, to coding apps with my knees behind my ears, cramped in economy class at 20.000 feet up in the air.

I don’t want to go all nostalgic on you, but I learned to code on a 100 Mhz i486 PC, when lines still started with a number. That’s a lot faster PC than the one that put man on the moon, at 46 Khz.

So, to say that a Mac Mini, or your new 2015 MacBook Pro, is fast enough, is an understatement…

If you buy a second hand Mac, make sure that it supports the latest version of macOS. Xcode and iOS versions are connected to macOS versions, so you want to buy a Mac that supports at least the current ones. You can find the max. latest version of Xcode that your Mac can run, by cross-referencing the min macOS to run in this wiki with Hardware compatibility in this wiki.

Code Swift with a Swift Sandbox

Do you really need Xcode to code apps? Ultimately, yes. But you can definitely learn Swift and code Swift without a Mac or Xcode!

Here, check this out:

func fibonacci(_ i: Int) -> Int {
if i <= 2 {
return 1
} else {
return fibonacci(i - 1) + fibonacci(i - 2)
}
}
let numbers = Array(1..10).map { fibonacci($0) }
print(numbers)

The above code runs in a Swift sandbox. The sandbox sends the Swift code to a webserver, which compiles it and returns the result. It’s the perfect tool to quickly play with some Swift code in your browser!

Swift is an open-source language, and that means you can effectively run it on any hardware.

Need more space for your Swift code? Check out the bigger Swift Sandbox right here!

Learn how to code iOS apps

Get started with Xcode and Swift

Ready to get started with iOS development? Learn how to code iOS apps with Xcode and Swift with our immersive iOS development course. Works both on Mac and PC!

Further Reading

You can’t build iOS apps without Xcode, and you need macOS to run Xcode, and a Mac to use macOS. There’s no getting around it, except for these alternatives to run Xcode on Windows:

  • Rent a Mac in the cloud (starting at $20/mo)
  • Run Xcode on Windows by installing macOS on a virtual machine
  • Build your own “Hackintosh” by installing macOS on a PC
  • Develop iOS apps on Windows with cross-platform tools
  • Get your hands on a second-hand Mac (starting at $300)
  • Learning to code with a Swift Sandbox
  • Run and compile Swift directly on Windows/Linux

Awesome. I want to wish you best of luck with building your iOS app on Windows! Here are a few projects and tutorials to consider:

-->

You can use Visual Studio with the cross-platform Mobile development with C++ tools to edit, debug, and deploy iOS code to the iOS Simulator or to an iOS device. But, because of licensing restrictions, the code must be built and run remotely on a Mac. To build and run iOS apps using Visual Studio, you need to set up and configure the remote agent, vcremote, on your Mac. The remote agent handles build requests from Visual Studio and runs the app on an iOS device connected to the Mac, or in the iOS Simulator on the Mac.

Note

For information on using cloud-hosted Mac services instead of a Mac, see Configure Visual Studio to connect to your cloud hosted Mac. The instructions are for building using Visual Studio Tools for Apache Cordova. To use the instructions to build using C++, substitute vcremote for remotebuild.

Once you have installed the tools to build using iOS, refer to this article for ways to quickly configure and update the remote agent for iOS development in Visual Studio and on your Mac.

Prerequisites

To install and use the remote agent to develop code for iOS, you must first have these prerequisites:

  • A Mac computer running macOS Mojave version 10.14 or later

  • An Apple ID

  • An active Apple Developer Program account

    You can get a free account that allows sideloading apps to an iOS device for testing only but not for distribution.

  • Xcode version 10.2.1 or later

    Xcode can be downloaded from the App Store.

  • Xcode command-line tools

    To install the Xcode command-line tools, open the Terminal app on your Mac and enter the following command:

    xcode-select --install

  • An Apple ID account configured in Xcode as a signing identity to sign apps

    To see or set your signing identity in Xcode, open the Xcode menu and choose Preferences. Select Accounts and choose your Apple ID, and then choose the View Details button. See Add your Apple ID account for detailed instructions.

    For detailed information on signing requirements, see What is app signing.

  • If you are using an iOS device for development, a provisioning Profile configured in Xcode for your device

    Xcode provides automatic signing where it creates signing certificates for you as needed. For detailed information about Xcode automatic signing see automatic signing.

    If you want to do manual signing, you need to create a provisioning Profile for your app. For detailed information on creating provisioning Profiles, see Create a development provisioning profile.

  • Node.js version 12.14.1 and npm version 6.13.4

    Install version 12.14.1 of Node.js on your Mac. If you install the Node.js package, it should come with npm version 6.13.4. Other versions of Node.js and npm may not support some modules used in the remote agent vcremote, which can cause vcremote installation to fail. We recommend you install Node.js by using a package manager such as Node Version Manager. Avoid using the command sudo to install Node.js, as some modules can fail to install when using sudo.

Install the remote agent for iOS

When you install the Mobile development with C++ workload, Visual Studio can communicate with vcremote, a remote agent running on your Mac to transfer files, build and run your iOS app, and send debugging commands.

Before you install the remote agent, make sure you have satisfied the Prerequisites and completed the installation steps in Install cross-platform mobile development with C++.

To download and install the remote agent

  • From the Terminal app on your Mac, verify that the Node.js version currently in use is the required version 12.14.1. To verify the version, run the command:

    node -v

    If it's not the right version, you may need to follow the Node.js installation instructions in the prerequisites. Then, restart Node.js.

  • After verifying the required Node.js is in use, run this command to install vcremote under that Node.js version:

    npm install -g --unsafe-perm vcremote

    The global installation (-g) switch is recommended, but not required. If you don't use the global installation switch, vcremote gets installed under the current active path in the Terminal app.

    During the installation, vcremote is installed and developer mode is activated on your Mac. Homebrew and two npm packages, vcremote-lib and vcremote-utils, are also installed. When installation completes, it's safe to ignore any warnings about skipped optional dependencies.

    Note

    To install Homebrew, you must have sudo (administrator) access. If you need to install vcremote without sudo, you can install Homebrew manually in a usr/local location and add its bin folder to your path. For more information, see the Homebrew documentation. To manually enable developer mode, enter this command in the Terminal app: DevToolsSecurity -enable

If you update to a new version of Visual Studio, you must update to the current version of the remote agent as well. To update the remote agent, repeat the steps to download and install the remote agent.

Start the remote agent

The remote agent must be running for Visual Studio to build and run your iOS code. Visual Studio must be paired with the remote agent before it can communicate. By default, the remote agent runs in secured connection mode, which requires a PIN to pair with Visual Studio.

To start the remote agent

  • From the Terminal app on your Mac, enter:

    vcremote

    This command starts the remote agent with a default build directory of ~/vcremote. For additional configuration options, see Configure the remote agent on the Mac.

The first time you start the agent, and every time you create a new client certificate, you are provided with the required information to configure the agent in Visual Studio, including the host name, the port, and the PIN.

If you intend to configure the remote agent in Visual Studio using the host name, ping the Mac from Windows using the host name to verify that it is reachable. Otherwise, you may need to use the IP address instead.

The generated PIN is for one time use, and is only valid for a limited time. If you do not pair Visual Studio with the remote agent before the time expires, you will need to generate a new PIN. For more information, see Generate a new security PIN.

You can use the remote agent in unsecured mode. In unsecured mode, the remote agent can be paired to Visual Studio without a PIN.

To disable secured connection mode

  • To disable secured connection mode in vcremote, enter this command in the Terminal app on your Mac:

    vcremote --secure false

To enable secured connection mode

  • To enable secured connection mode, enter this command:

    vcremote --secure true

Once you have started the remote agent, you can use it from Visual Studio until you stop it.

To stop the remote agent

  • In the Terminal window vcremote is running in, enter Control+C.

Configure the remote agent in Visual Studio

To connect to the remote agent from Visual Studio, you must specify the remote configuration in the Visual Studio options.

To configure the remote agent from Visual Studio

  1. If the agent is not already running on your Mac, follow the steps in Start the remote agent. Your Mac must be running vcremote for Visual Studio to successfully pair, connect, and build your project.

  2. On your Mac, get the host name or IP address of your Mac.

    You can get the IP address by using the ifconfig command in a Terminal window. Use the inet address listed under the active network interface.

  3. On the Visual Studio menu bar, choose Tools, Options.

  4. In the Options dialog box, expand Cross Platform, C++, iOS.

  5. In the Host Name and Port fields, enter the values specified by the remote agent when you started it. The host name can be the DNS name or IP address of your Mac. The default port is 3030.

    Note

    If you cannot ping the Mac using the host name, you may need to use the IP address.

  6. If you use the remote agent in the default secured connection mode, check the Secure checkbox, then enter the PIN value specified by the remote agent in the Pin field. If you use the remote agent in unsecured connection mode, clear the Secure checkbox and leave the Pin field blank.

  7. Choose Pair to enable the pairing.

    The pairing persists until you change the host name or port. If you change the host name or port in the Options dialog box, to undo the change, choose the Revert button to revert to the previous pairing.

    If the pairing does not succeed, verify that the remote agent is running by following the steps in Start the remote agent. If too much time has passed since the remote agent PIN was generated, follow the steps in Generate a new security PIN on the Mac and then try again. If you are using the host name of your Mac, try using the IP address in the Host Name field instead.

  8. Update the folder name in the Remote Root field to specify the folder used by the remote agent in your home (~) directory on the Mac. By default, the remote agent uses /Users/<username>/vcremote as the remote root.

  9. Choose OK to save the remote pairing connection settings.

Visual Studio uses the same information to connect to the remote agent on your Mac each time you use it. You do not need to pair Visual Studio with the remote agent again unless you generate a new security certificate on your Mac, or its hostname or IP address changes.

Generate a new security PIN

When you start the remote agent the first time, the generated PIN is valid for a limited amount of time—by default, 10 minutes. If you don't pair Visual Studio to the remote agent before the time expires, you will need to generate a new PIN.

Family tree software mac os x

Apps

To generate a new PIN

  1. Stop the agent, or open a second Terminal app window on your Mac and use that to enter the command.

  2. Enter this command in the Terminal app:

    vcremote generateClientCert

    The remote agent generates a new temporary PIN. To pair Visual Studio by using the new PIN, repeat the steps in Configure the remote agent in Visual Studio.

Generate a new server certificate

Swift Mac Os

For security purposes, the server certificates that pair Visual Studio with the remote agent are tied to the IP address or host name of your Mac. If these values change, you must generate a new server certificate, and then reconfigure Visual Studio with the new values.

To generate a new server certificate

  1. Stop the vcremote agent.

  2. Enter this command in the Terminal app:

    vcremote resetServerCert

  3. When prompted for confirmation, enter Y.

  4. Enter this command in the Terminal app:

    vcremote generateClientCert

    This command generates a new temporary PIN.

  5. To pair Visual Studio by using the new PIN, repeat the steps in Configure the remote agent in Visual Studio.

Configure the remote agent on the Mac

You can configure the remote agent using various command-line options. For example, you can specify the port to listen for build requests and specify the maximum number of builds to maintain on the file system. By default, the limit is 10 builds. The remote agent will remove builds that exceed the maximum on shutdown.

To configure the remote agent

  • To see a complete list of remote agent commands, in the Terminal app, enter:

    vcremote --help

  • To disable secure mode and enable simple HTTP-based connections, enter:

    vcremote --secure false

    When you use this option, clear the Secure checkbox and leave the Pin field blank when configuring the agent in Visual Studio.

  • To specify a location for remote agent files, enter:

    vcremote --serverDir directory_path

    where directory_path is the location on your Mac to place log files, builds, and server certificates. By default, this location is /Users/<username>/vcremote. Builds are organized by build number in this location.

  • To use a background process to capture stdout and stderr to a file named server.log, enter:

    vcremote > server.log 2>&1 &

    The server.log file can assist in troubleshooting build issues.

  • To run the agent by using a configuration file instead of command-line parameters, enter:

    vcremote --config config_file_path

    where config_file_path is the path to a configuration file in JSON format. The startup options and their values must not include dashes.

Troubleshoot the remote agent

Debugging on an iOS device

If debugging on an iOS device does not work, there could be issues with the tool ideviceinstaller, which is used to communicate with an iOS device. This tool is typically installed from Homebrew during the installation of vcremote. Follow the steps below as a workaround.

Open the Terminal app and update ideviceinstaller and its dependencies by running the following commands in order:

  1. Ensure Homebrew is updated

    brew update

  2. Uninstall libimobiledevice and usbmuxd

    brew uninstall --ignore-dependencies libimobiledevice

    brew uninstall --ignore-dependencies usbmuxd

  3. Install the latest version of libimobiledevice and usbmuxd

    brew install --HEAD usbmuxd

    brew unlink usbmuxd

    brew link usbmuxd

    brew install --HEAD libimobiledevice

  4. Uninstall and reinstall ideviceinstaller

    brew uninstall ideviceinstaller

    brew install ideviceinstaller

Verify that ideviceinstaller can communicate with the device by trying to list the apps installed on the device:

Building Mac Os Apps Using Swift Free

ideviceinstaller -l

If ideviceinstaller errors that it cannot access the folder /var/db/lockdown, change the privilege on the folder with:

sudo chmod 777 /var/db/lockdown

Then verify again if ideviceinstaller can communicate with the device.

See also