• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

How to emulate iOS using Docker

AnonyViet by AnonyViet
January 24, 2023
in Network
0

After many unsuccessful attempts, I was finally able to virtualize macOS to test iOS apps. But before you do, you should know this is not a stable solution and has some performance issues. I need to do this for some reason.

Join the channel Telegram of the AnonyViet 👉 Link 👈

How to emulate iOS using Docker

We will use QEMU to emulate the mac and inside of it we will use xCode to emulate iOS. This process will not be easy. ‘s github repository Docker OSX there is an explanation on how to use iPhone via usb instead of emulator, but I don’t have an iPhone :(.

What is Docker OSX?

Docker OSX is a docker image that uses QEMU so that we can emulate an operating system.

You can learn more about Docker here.

Hardware parameters when emulating iOS with Docker

My computer specs are considered pretty decent for doing this, however, I still feel lag when using Docker OSX + xCode + Visual Studio Code + Dev Server. (The machine is like a fireplace :v)

  • OS: Manjaro Linux x86_64
  • Kernels: 4.19.220-1-MANJARO
  • Shell: zsh 5.8
  • Resolution: 1440×900
  • DE: GNOME 41.2
  • WM: Mutter
  • WM Theme: Orchis-orange-compact
  • Icons: Win11-purple-dark [GTK2/3]
  • Terminal: gnome-terminal
  • CPU: Intel i7-3770 (8) @ 3,900GHz
  • GPUs: NVIDIA GeForce GTX 1050 Ti
  • RAM: 4105MiB / 15985MiB
  • SSDs: Crucial BX500 240gb (It is recommended to use SSD)

Setting

First, need to install docker on your computer. I use Manajaro, so I just open a terminal and enter the following commands:

Install docker: pacman -S docker

Run docker: systemctl start docker.service

Enable docker to start on system:systemctl enable docker.service

Check docker:docker run hello-world

How to emulate iOS using Docker 26

Next, we will download docker osx and run it with the command below:

docker run -it --device /dev/kvm -p 50922:10022 -e DEVICE_MODEL="iMacPro1,1" -e WIDTH=1440 -e HEIGHT=900 -e RAM=8 -e INTERNAL_SSH_PORT=23 -e AUDIO_DRIVER=alsa -e CORES=2 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e GENERATE_UNIQUE=true -e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist sickcodes/docker-osx:big-sur

You can check the meaning of each flag at github’s docker osx. But to summarize briefly, I have specified resolution, memory, cpu cores, version and other things.

Then the docker osx will be downloaded and initialized.

When the emulator opens, select macOS Base System

How to emulate iOS using Docker 27

When the system is started, selectDisk Utility

How to emulate iOS using Docker 28

Now, we will find the prepared partition and select Erase.

How to emulate iOS using Docker 29

For formatting, the options should be exactly like the image below:

How to emulate iOS using Docker 30

Click Erase, wait for the process to finish and then you can close the Disk Utility window.

Next, choose Reinstall macOS Big Sur, accept the terms and select the partition we just created macOS and start the installation. (This can take anywhere from 30 minutes to an hour.)

How to emulate iOS using Docker 31

The system will reboot on its own (or not), I have to do it manually because it doesn’t reboot. In that case, close the QEMU window.

How to emulate iOS using Docker 32

In the terminal, we will enter:

docker ps -a

To know what our container ID is and then you need to enter the command below:

docker start ID

How to emulate iOS using Docker 33

After that, the system will automatically reboot (or not), so close QUEMU and restart the container.

How to emulate iOS using Docker 34

When the system boots, select the option macOS Installer and wait for the process to finish. When finished, the system will reboot.

So macOS has been installed successfully. Select macOS.

How to emulate iOS using Docker 35

The welcome screen of macOS has appeared, now you need to set up macOS.

How to emulate iOS using Docker 36

When configuring the system, but don’t sign in AppleID.

When that process is complete, our screen will appear and we will wait until the dock appears because then the system will be most stable.

How to emulate iOS using Docker 37

How to emulate iOS using Docker 38

Now, we will use brew to install packages faster.

Open terminal in macOS and install brew with the command below:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Enter your password and wait for the process to finish.

Now, we will install xcode on Apple Store.

How to emulate iOS using Docker 39

At this point, we need to log in with AppleID.

How to emulate iOS using Docker 40

Then open xcode and accept the terms and wait for the dependencies to be installed.

Next go to Preferences -> Locations -> Command-Line Tools, select the xCode version.

Once the installation is complete, we will reopen the terminal and install cocoapods with the command below. It serves as xCode’s packager manager.

brew install cocoapods

Finally, our macOS will be installed and configured to run the projects.

Run the app with React Native

Next, we’ll try to run a simple React Native program. I only test on iOS.

Open tterminal and enter the following commands:

Install node: brew install node

Install yarn (optional): npm install -g yarn

Create RN project: npx react-native init teste

If asking you to reinstall cocoapods, choose the option with brew.

Access the project directory: cd teste

Access the ios folder: cd ios

Install dependencies: pod install

Back to the root directory: cd ..

List all available devices (optional): xcrun simctl list devices

Run the project with xcode: npx react-native run-ios --simulator="iPhone 13"

How to emulate iOS using Docker 41

Run the application with Cordova

Next is to run the project with Quasar to check if everything we’ve done is working.

Quasar uses Cordova/Capacitor for iOS and Android.

Install node: brew install node

Install yarn: npm install -g yarn

Install quasar: yarn global add @quasar/cli

Install cordova: yarn global add cordova

*Create a project with Quasar: quasar create teste

Access the project directory: cd teste

Add cordova to your project: quasar mode add cordova

Access the cordova folder: cd src-cordova

Add iOS to the project: cordova platform add ios

Verify if everything is ok: cordova requirements

List all available devices (optional): cordova emulate iOS --list

Install dependencies: yarn

Back to the root directory: cd ..

Install dependencies: yarn

Run quasar with development mode on iOS: quasar dev -m iOS -e "iPhone 8, 15.2"

How to emulate iOS using Docker 42

Connecting folders via SSH

Now our application is running on macOS, but there will be some problems: Opening the code editor or IDE inside macOS is a very bad experience because the machine runs slow, errors, keyboard mapping, etc. So, I been working on a solution to make a file connection using SSH.

Alternatively, I can open the development server inside of macOS and make a direct connection from my linux or macOS so it updates both sides, like bidirectional. This ensures we take full advantage of features in development mode, such as fast refresh.

Connecting from linux to mac

First, we need to allow connection over ssh through mac. To do this, we need to open the terminal and enter:

Command to open edit ssh config file: sudo nano /etc/ssh/sshd_config

Find PasswordAuthentication and put yes and remove the # in the first line.

How to emulate iOS using Docker 43

Save the file again.

Go to System Preferences -> Sharing -> Remote Login and enable all users:

How to emulate iOS using Docker 44

Command to restart ssh: sudo launchctl stop com.openssh.sshd && sudo launchctl start com.openssh.sshd

Now, in the linux terminal:

Install sshfs: sudo pacman -S sshfs

Get the container IP: docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ID_CONTAINER

Create folder: mkdir projeto

Command to open a new connection to mac: sudo sshfs USER_MAC@IP_CONTAINER:/PATH/OF/PROJECT/ON/MAC /PATH/ON/LINUX -p 23

Eg:

How to emulate iOS using Docker 45

Okay, now we can open VSCode on linux and update files directly on mac.

Connect from Mac to Linux

Same as above, but the sshfs package on mac can be installed with the command below:

Install sshfs: brew install --cask macfuse && brew install gromgit/fuse/sshfs-mac

On Linux:

Command to edit ssh config file: sudo nano /etc/ssh/sshd_config

Find PasswordAuthentication and put yes and remove the # in the first line.

How to emulate iOS using Docker 43

Save the file.

Command to restart SHH on Manjaro: sudo systemctl restart sshd.service

On Mac, we will create a folder to open the connection.

Create folder: mkdir projeto

Command to open a new connection to linux: sudo sshfs USER_LINUX@IP_HOST:/PATH/LINUX /PATH/MAC -p 23

When we type the command, an error occurs.

How to emulate iOS using Docker 47

Open preferences and click Allow

How to emulate iOS using Docker 48

Restart your mac.

Now we can open the connection: (My SSH is open on a different port, but default is 22)

How to emulate iOS using Docker 49

Once done, we can update from either side. That’s it, very suitable for remote work, code team.

The article achieved: 5/5 – (100 votes)

Tags: DockeremulateiOS
Previous Post

Lesson 113: How to use the IF function in Excel

Next Post

3 Ways to enter Medium.com without the latest IP blocking

AnonyViet

AnonyViet

Related Posts

Guide to self -creation socket5 on Ubuntu
Network

Guide to self -creation socket5 on Ubuntu

May 28, 2025
How to create a separate mtproto proxy to use Telegram when blocked
Network

How to create a separate mtproto proxy to use Telegram when blocked

May 25, 2025
Script backup database and website on telegram
Network

Script backup database and website on telegram

May 2, 2025
Create 64GB RAM 16 core for free on Google IDX
Network

Create 64GB RAM 16 core for free on Google IDX

April 13, 2025
What is VPS running Vietnamese software? What is the reason for installing Vietnamese software on VPS?
Network

What is VPS running Vietnamese software? What is the reason for installing Vietnamese software on VPS?

February 17, 2025
Create Ronin wallet to play pixels on VPS Windows
Network

Create Ronin wallet to play pixels on VPS Windows

February 17, 2025
Next Post
3 Ways to enter Medium.com without the latest IP blocking

3 Ways to enter Medium.com without the latest IP blocking

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply