So, woke up this morning, checked my LinkedIn account, and, the most amazing thing happened. Someone had posted a solution to a problem I have been having for a long time, and it was awesome. Being a once in a while mobile apps developer, I always looked for ways to be able to test my hybrid React Native apps on an iPhone device to no avail. Basically, unless you have a macOS, or an iPhone, good luck testing your app. This always led to issues, like the well-known Internet Explorer explorer issues, whereby your app looks great on Chrome and Firefox but when you it check out Internet Explorer it looks like the app went to hell and came back.
Based on the post, one can use sosumi to run macOS on their Linux machines. So, I embarked on a journey to try and figure out how I can pull this off. I then came across this article by Logix on the Linux Uprising blog, which provides an awesome step by step guide on getting the stuff running on one's machine. I definitely suggest a read. While trying out the steps, I hit a snag, kind of a big one, my machine did not have enough space for a complete installation. I however had different partitions with enough space to accommodate the installation. The problem though, is that I didn't know how to install it in a different partition. Then came a comment by Hikmat E Ustad, providing an alternative way to install from a YouTube video he created. The video can be found here.
The video did not provide a solution to my problem but after contacting him(basically wrote a comment), he directed me to a link which provided me a with a starting point. That is when the fun started.
- To create a virtual drive, search and open
virt-manageron your Linux OS, I use Ubuntu so it was already installed.
- We then add the disk to the KVM Storage pool via virt-manager. To create a new VM, on the menu bar, click on edit, then choose "Connection Details".
- Open the "Storage" tab then click the green + button on the far bottom left. On the popup window, write the
Name, then on the
dir: Filesystem Directory, on the
Target Path, click the
Browsebutton on the right.
File Explorerwill popup and you have to select a location as your target. This is where we select the partition we want.
To select a partition, click on
+ Other Locationson the left sidebar of the
file explorerwindow. You will then see the list of all your partitions, normally with a
/dev/<some name>on the right. Mine was
/dev/sdb2. Click on the partition to mount it then you can create a folder inside and set the folder as your
target path. You can then click the green button on the top-right of the window. The most important part is getting the path to the partition, this can be found once you click the green button at the top right, and on the next popup window, click finish.
Once you are done creating the pool above, the "Connection Details" window will be open and from the left sidebar choose the name of the pool you created. Details of that pool will be displayed on the right. Keep this window open and follow the instructions below to install macOS on your machine.
Go to this repo and follow the instructions step by step up to the part below:
qemu-img create -f qcow2 mac_hdd_ng.img 128G
The command above creates a virtual hdd image where macOS will be installed. We have to change the location to the pool target we created above. Go back to point 6. and copy
Location, it is usually something like this
/media/<username>/01D6CA5DC685C8B0/<folder you created>. Replace the above command with:
# PS: 128G is the size of the virtual drive in Gigabytes that will be created qemu-img create -f qcow2 /media/<username>/01D6CA5DC685C8B0/<folder you created>/mac_hdd_ng.img 128G
The command creates a
128GB virtual hdd in the location you specified, in this situation, the partition you added to the pool. After running the command above, since we changed the location of our virtual hdd, we also need to set this location in our script which will be run immediately after this command. So before running the script, we need to open it and change the location. To open the script:
This opens the script in the terminal, we can then create a new variable, find the line with the variable
REPO_PATH="." and on the next line add this variable:
NVM_PATH="/media/<username>/01D6CA5DC685C8B0/<folder you created>"
Then find this line:
$NVM_PATH, then save and close by pressing
Enter. You can then run the script by typing:
Note: This might not necessarily be the best approach but it it the approach that worked for me. In case I made any mistake, please feel free to constructively criticize in the comments.