未加星标

Virtualize OS X on Linux

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏
Preamble

I've been a linux user for something like 10 years now. In order to develop and maintain psutil on different platforms I've been using the excellent VirtualBox . With it, during the years, I've been able to virtualize different versions of windows, FreeBSD, OpenBSD, NetBSD and Solaris and implement and protract support for such platforms inside psutil. Without VirtualBox there really wouldn't exist psutil as it stands nowadays.

At some point I also managed to virtualize OSX by using an hacked version of OSX called iDeneb which is based on OSX 10.5 / Leopard (note: 9 years old), and that is what I've been using up until today. Of course such an old hacked version of OSX isn't nice to deal with. It ships python 2.5, it kernel panicks, I had to reinstall it from scratch quite often and people (rightfully) make fun of you . Thank you iDeneb: I loved and hated you at the same time. =)

Vagrant

I'm really not sure how Icouldhave been missing this for all this time, but it turns out emulating OSX on Linux really is as easy as executing a one-liner:

vagrant init AndrewDryga/vagrant-box-osx; vagrant up

And that really is it! I mean... you're literally good to go and start developing! That will create a Vagrant file, download a pre-configured OSX image via internet (10GB or something) and finally run it in VirtualBox. The whole package includes:

OSX 10.10.4 / Yosemite XCode 6.4+ gcc brew Python 2.7

In a couple of hours I modified the original Vagrantfile a little and managed to mount a directory which is shared between the VM and the host (my laptop) and ended up with this Vagrantfile .

Development workflow

This is the second best part, and it represents why Vagrant is such a great tool. So far in order to virtualize a platform and develop on it I had to:

download the platform ISO (BSD, SunOS or whatever) manually install it in VirtualBox install deps, configure the platform, setup SSHd

In order to automatize the system configuration I came up with a bunch of automation scripts but that really is another story. With that done, every time I wanted to work on psutil I had to:

open VirtualBox (GUI) "get into it" (by clicking with the mouse), open a terminal, get the IP address get out of VirtualBox, open a local terminal, SSH into the VM open the GUI file manager, SFTP into the VM, open the source files with my editor (Sublime), finally start working With Vagrant the workflow becomes much more easier as no GUI is involved. Everything happens in the terminal (2 actually):

I install and run the VM with "vagrant up" I SSH into it with "vagrant ssh" in one terminal (without knowing any IP) I edit files locally in another terminal

That's it. The best part is that Vagrant (or VirtualBox?) does the necessary magic so that a local directory (the one where you have your source files) will be mapped and visible inside the VM. With that you can edit the source files locally without ever connecting to the VM via an IP address, SFTP or whatever.

I will likely get rid of my other VMs installed "manually" and do the same: rely on Vagrant. Actually I already did for OpenBSD and NetBSD but I'm still not happy with what i have. In summary, I think this is a great improvement in terms of productivity, and I wish I had discovered this sooner.

Reddit discussion

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: LinuxWindowsPython
分页:12
转载请注明
本文标题:Virtualize OS X on Linux
本站链接:http://www.codesec.net/view/481777.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(25)