- matix.io
- We’re working to make things easier.
- Introducing RNBuildAnywhere
- Getting started
- Setting up the Mac
- SSH Access
- Xcode toolchain
- fastlane
- Git access
- Other build requirements for React Native
- Setting up the Linux machine
- SSH Access to the Mac
- Install required tools
- Apple Developer setup
- Bundle ID creation
- Team ID
- Devices
- React Native project setup
- Building the project
- Uploading the project to the MacOS server
- Updating the project on the MacOS server
- Executing the build on the remote server
- Downloading the .ipa file
- Installing the .ipa file
- NoDrama
- Developing mobile iOS applications on GNU/Linux with Re-Natal
- Intro
- Running macOS in a VirtualBox
- Install XCode
- Install socat
- Creating the project
- Share the project folder
- Development tools: React Native and Figwheel
- Run the project
- linux — [Solved-5 Solutions] How to Start iPhone app development in Linux ? — ubuntu — red hat — debian — linux server — linux pc
- Linux — Problem :
- Linux — Solution 1:
- Linux — Solution 2:
- Linux — Solution 3:
- Linux — Solution 4:
matix.io
Apple has done a great job of locking in developers by ensuring the Xcode toolchain can only run on MacOS products. For people who prefer working on Linux machines, this is very frustrating. We wanted a way to run our builds from our Linux computers.
We managed to find a solution for building from a Linux computer, however it still requires using a MacOS server in the backend.
We’re working to make things easier.
Before you get too excited, the methods described in this article still require that you have a MacOS machine to build your project on. That means additional infrastructure to pay for and manage (which is likely what you’re trying to avoid in the first place).
Introducing RNBuildAnywhere
At matix.io, we’re currently working on a service which manages all the technical difficulties described in this article for you. How does it work?
That’s it. Your project is shipped off to a build server and you’re returned a file to install on your iPhone, so you can continue building and not worry about the technical difficulties.
Interested? Fill out the form below and we’ll be in touch to talk about how we can work together.
Getting started
- A Mac. This can be a physical machine like an old Macbook, a Mac Mini, or a Mac Server. Or, it could be a Mac VPS rented from a service like MacinCloud or other VPS providers.
- A Linux computer.
- An iPhone or iPad connected via USB to the Linux computer.
Setting up the Mac
SSH Access
First thing’s first: you’re going to need to be able to SSH into the Mac from your Linux machine. That means you’ll need to enable remote connections on the Mac and add your public SSH key to the
We won’t cover the SSH setup in this tutorial, but there are many resources on the internet which can help you do so.
Xcode toolchain
Install the Xcode command line tools by running:
fastlane
fastlane is a toolkit for automating tasks related to iOS and Android builds. We use it to do the complicated things like managing provisioning profiles and codesigning.
Git access
You’ll need to create a git repository, on Gitlab or Github, where fastlane will store your signing certificates (encrypted). Your Mac needs to be set up to access this git repository via an SSH url (e.g. [email protected]:user/repo.git).
If you can clone the repo without it asking for a username / password, you’re all good.
Other build requirements for React Native
Any tools that you use to build your React Native project need to be available. For example, npm , yarn , etc.
Setting up the Linux machine
SSH Access to the Mac
To make your life simpler, set up a record in your
/.ssh/config file so that you can easily SSH into the Mac. This will make using some of the other tools easier.
We’ll assume that you can SSH into your Mac machine by using the command ssh mac .
Install required tools
You’ll need to have access to the following commands:
Apple Developer setup
Bundle ID creation
You’ll need to make sure your bundle identifier is created. To do this:
- Visit https://developer.apple.com/account/
- Sign in with your account
- Navigate to https://developer.apple.com/account/resources/identifiers/list
- Add a new App identifier
Take note of your Bundle Identifier you entered
Team ID
You need to note your Team ID. You can get this by visiting https://developer.apple.com/account/#/membership/.
Devices
You need to make sure your device is added to the list at https://developer.apple.com/account/resources/devices/
React Native project setup
The important thing here is getting your project set up to build with fastlane. We’ll start from a fresh React Native project to illustrate things from the start.
First, we’ll create a new React Native project:
Then, we’ll initialize fastlane for the project:
When it asks you What would you like to use fastlane for?, select Manual setup.
Finally, you need to create your Fastfile , which tells fastlane what commands to execute (in this case to build the React Native project).
This takes some tinkering. Here’s what worked for us:
After that, you should be good to go!
Building the project
Finally, here’s the fun part! Here are the steps for building:
- Uploading the project to the MacOS server. This will be run once, for the first build.
- Updating the project on the MacOS server. On the first build, this will do nothing, but on subsequent builds we’ll upload any changes.
- Executing the build on the MacOS server.
- Downloading the built .ipa file.
- Installing the built .ipa file to the iPhone, connected to your Linux computer.
Uploading the project to the MacOS server
To do the initial upload, we’re going to create a tarball of the project and upload it to the remote server. This is especially important if you have a large project, as the tarball upload will be quicker than the method we will use to update files on the remote server. The issue, though, is that we do not want to include any installed dependencies (such as node_modules or installed Pods).
Luckily, react-native init generates a .gitignore file which excludes all these by default.
If you haven’t set up a git repo for your project, you need to do the following:
Then, we’ll create a tarball of the project as follows:
We’ll upload the new archive to the MacOS server and extract it:
Finally, we’ll clean up the mess we made.
Updating the project on the MacOS server
This part is a bit simpler. After we’ve uploaded the initial tarball, we’ll use rsync to upload any changes we make. Again, we’ll need to make sure we don’t upload any of the node_modules or other dependencies.
That’s it! rsync is a great tool.
Executing the build on the remote server
This is also a single command, luckily!
We’re going to use two variables when we run the build:
- FASTLANE_PASSWORD passes your icloud password to Fastlane (use to access the API to download provisioning profiles and code signing certificates
- MATCH_PASSWORD is the password Fastlane uses to encrypt your generated provisioning profiles and signing certificates.
Downloading the .ipa file
This is a quick and easy step:
Installing the .ipa file
Plug in your phone, and grant the Linux computer permission to access it. Then, simply run
That’s it, the app should be installed on the iOS device!
NoDrama
Clojure | Clojurescript | DevOps | Rust | Blockchain
Developing mobile iOS applications on GNU/Linux with Re-Natal
Intro
If you are a developer writing mobile applications in the year 2019, chances are you are working with React Native. React Native workflow is split into two separate steps. One is the packager, an engine which lets you work with the native mobile UI components through JavaScript, that reloads every time you save your JavaScript code. The other is the simulator.
Unfortunately, to run the iOS simulator and do any kind of iOS development you need a macOS and the XCode IDE. If you’re like me, my Linux setup is just paramount to my productivity and I can’t imagine working without e.g. a tiling window manager or keyboard shortcuts perfected by the years of practice 🙂
In this blog post I will show you the setup and workflow that allows you to write your code in the OS and code editor of your choice 1 , while still running the iOS simulator.
Re-Natal
Re-Natal is a CLI tool to automate the setup of a React Native app running on ClojureScript. In a few simple commands it will bootstrap a skeleton application with reagent + re-frame, REPL and hot reloading (using Figwheel) directly to the simulated iOS device, just like you would if it was a web app running in a browser.
If you like the idea let’s get started.
We are going to install all the neccessary development tools on the host machine, and just the bare minimum required to run the iOS simulator on a guest macOS running in a VirtualBox, then make the two machines talk to each other via forwarded ports.
Running macOS in a VirtualBox
Begin by insatlling VirtualBox 6.X for your distribution, you can get it from here or directly from your OS repositories:
Now download the vmdk with macos, for example from Techsviewer. Launch VB and create new virtual machine from the image. Make sure to name the VM without using spaces (e.g. macos). Give the machine at least 2 cores, 4GB of RAM, and 128MB of graphics with 3D acceleration turned on, set the VB Network Adapter to Bridged:
Close Virtualbox for now. Now you can download the setup script, graciously made availiable by hkdb.
Save the script, make it executable and call it with the name of your vm and the desired resolution as the arguments:
Launch VirtualBox again and start the MacOS VM.
Install XCode
Once the VM boots you can install the XCode version for the MacOS version you are running:
You can use the App Store, or for the older versions of the IDE they can be downloaded from here.
Once installed launch Xcode, select menu > Preferences > Locations and choose your Xcode version from the dropdown:
Install socat
For bidirectional data communication between the Linux host and macOS guest we will use socat. MacOS doesn’t have a native package manager, therefore we will need Homebrew installed. Start the Terminal and install it:
then using homebrew install socat:
We are done with the guest for now, lets go to the host and create our project.
Creating the project
Lets start by installing re-natal and react-native. Both come as convenient node packages, that we can install globally:
You will also need Leiningen and Java 8, but we won’t cover installing them here.
Once that’s done we can create the skeleton app. Mind the CamelCase in the apps name:
Now execute some basic setup commands that will bootstrap the app as an iOS project:
Share the project folder
We will need to share the projects directory with the guest. In principle virtualbox can share folders betwen the host and the guest using Guest Additions, however I was unable to get it going 2 .
Instead I opted for using the samba server. Every major Linux distro should have it in its repositories:
Now create a user (samba will prompt you for the password):
Next edit the samba config:
Add to the end of the config, substitutting path with the path to the just created re-natal project and user with the created samba user:
You can test the config file for configuration errors by calling: testparm on the command line. If all is fine with the config, go ahead and start the Samba service daemon plus enable it at startup:
Development tools: React Native and Figwheel
We will now start the react-native packager, binding it to port 8081 and broadcasting on 0.0.0.0:
Next we can start Figwheel, which will give us the REPL, as well as watch and recompile on source code changes:
Figwheel will recompile the sources and just hang for now, waiting for connection with the simulator to give us the REPL, but not before printing the port on which it is running (3449 by default). Last piece of information we need is the local IPv4 address of the host (e.g. 192.168.1.3 ), which we can get with:
Now let’s go back to the guest OS.
Run the project
On the guest we can now start listening on the ports occupied by the react-native and Figwheel servers:
Next lets mount the shared folder. Click on the Go -> connect to server…, paste smb://192.168.1.3 and click on Connect:
When prompted for the username and password use the ones created when Sharing the project folder. by default the directory is mounted as /Volumes/app-name/ . Open this directory in XCode, wait until it indexes the project and run it.
Once the project is up and running Figwheel on the host box should now give you a fully functional REPL, with live reloading on code edits:
From now on the workflow is quite snappy and un-obtrusive, you can for example keep you editor and the simulator tiled one next to the other and quickly iterate during development.
Thanks for reading!
1: Allthough I don’t see how you could use anything else but Linux/Emacs combo.
2: Please let me know in the comment box if you had any luck yourself and how have you done it.
linux — [Solved-5 Solutions] How to Start iPhone app development in Linux ? — ubuntu — red hat — debian — linux server — linux pc
Linux — Problem :
How to Start iPhone app development in Linux ?
Linux — Solution 1:
- To give a differing response, I’m running OS X and Xcode on a virtualised (VMware) machine on Linux.
- CPU is a Core2Quad (Q8800), and it is perfectly fast.
- I found a prebuilt VM online Xcode/iPhone development works perfectly, as does debugging via USB to the phone itself.
Linux — Solution 2:
- There are two things to develop iPhone applications.
- You can try the Aptana mobile wep app plugin for eclipse which is nice, although still in early stage.
- It comes with a emulator for running the applications so this could be helpful.
- You can try cocoa (Extra)
Linux — Solution 3:
- The iPhone SDK and free software: not a match
- Apple’s recently released a software development kit (SDK) for the iPhone, but if you were hoping to port or develop original open source software with it.
- Code signing and nondisclosure conditions make free software a no-go.
- The SDK itself is a free download, with which you can write programs and run them on a software simulator.
- But in order to actually release software you’ve written, you must enroll in the iPhone Developer Program -a step separate from downloading the SDK, and one that requires Apple’s approval.
Linux — Solution 4:
There used to be a project dedicated to solve this defect: iphone-dev