- Запускаем Linux приложения на Mac
- 🍏 Как запускать приложения Mac на Linux
- Запустите виртуальную машину MacOS (все приложения)
- Использование Darling Translation Layer (только CLI)
- Сборка и установка дорогой Darling
- How to Run Mac Apps on Linux
- Run a macOS Virtual Machine (All Apps)
- Using the Darling Translation Layer (CLI Only)
- Building and Installing Darling
- Linux program on mac
- About
Запускаем Linux приложения на Mac
Запускаем Linux приложения на Mac
Linux обожают многие пользователи во всем мире ввиду его простоты и шикарным способностям индивидуальной настройки благодаря открытому исходному коду. Кроме того, все это абсолютно бесплатно! Многие пользователи Mac предпочитают запускать его в качестве виртуальной машины на VMWare , Parallels , или даже Virtual Box . Однако, иногда вам может понадобиться запустить Linux -приложения без необходимости постоянной смены системы. Используя SSH инструмент под названием X11 через SSH2, можно удаленно загрузить графическое Linux -приложение и юзать его прямо на вашем Mac .
Что вам понадобится:
>> Linux компьютер или виртуальная машина на Mac
>> Apple X11 ( скачать здесь )
Примечание: Вы можете использовать любой дистрибутив Linux , который вам нравится, но инструкции могут незначительно отличаться в зависимости от выбранного вами дистрибутива. Мы будем использовать Ubuntu , установленный на виртуальную машину.
1. Установка X11
Первым делом в установке приложения X11 является реализация Apple X Window System . Перед загрузкой и установкой X11 по ссылке выше, убедитесь, что приложение еще не было установлено ранее. Собственно процесс установки программного обеспечения мало отличается от обычной установки программ на МАС OS X .
2. Установка SSH в Ubuntu
Прежде чем мы начнем подключения к нашей машине Ubuntu , мы должны сначала установить SSH. SSH (или Secure Shell) — это способ, благодаря которому можно безопасно удаленно подключаться к вашему компьютеру через командную строку при помощи терминала на вашем Маке. По умолчанию эта функция не установлена.
Чтобы установить SSH в Ubuntu , откройте терминал (находится по пути Приложения> Стандартные ). После открытия терминала, введите команды, которые можно найти ниже, одну за другой, а затем нажмите клавишу ввода. Вам будет предложено ввести пароль после первого ввода команды.
sudo apt-get update sudo apt-get install ssh
После успешного завершения установки, и пока мы все еще в терминале, введите следующую команду, чтобы получить IP-адрес вашей Linux машины:
После ввода этой команды на экран поочередно будет выводиться несколько строк текста. IP-адрес под eth0 в поле “inet addr” и будет являться IP-адресом этого компьютера в вашей локальной сети. Именно его мы будем использовать для подключения через SSH в следующем шаге.
3. Подключение через SSH на вашем Mac
После успешного завершения двух предыдущих шагов, теперь вы можете, наконец, подключиться к Linux машине через SSH. Чтобы сделать это, откройте терминал на вашем Mac (находится в папке / Applications / Utilities ) и введите следующую команду:
ssh Username@IPAddress -X
Замените «Username» вашим именем пользователя на вашей Linux -машине, и замените «IPAddress» на адрес, который вы получили выполняя предыдущий шаг.
После ввода этой команды нажмите клавишу «ввод» , подключение будет открыто, и вы заметите, что приложение X11 также автоматически откроется. Это произошло потому, что мы добавили аргумент «-X» в команду, которая дает «сигнализирует» SSH о том, что мы собираемся использовать систему X Window удаленно.
Источник
🍏 Как запускать приложения Mac на Linux
macOS и Linux имеют общее наследие.
К сожалению, это не означает, что приложения могут плавно переходить между операционными системами.
Для запуска приложений Mac в Linux вам понадобится виртуальная машина или слой перехода.
Запустите виртуальную машину MacOS (все приложения)
Самый надежный способ запуска приложений Mac в Linux – через виртуальную машину.
С помощью бесплатного гипервизора с открытым исходным кодом, такого как VirtualBox, вы можете запускать macOS на виртуальном устройстве на вашем компьютере с Linux.
Правильно установленная виртуализированная среда MacOS без проблем запустит все приложения MacOS.
Подобная виртуализация рабочего стола требует значительного объема оперативной памяти, поэтому она может работать некорректно на устройствах с ограниченными ресурсами.
Для машин с техническими характеристиками наилучшим вариантом является виртуализация операционных систем через виртуальную машину VirtualBox.
Использование Darling Translation Layer (только CLI)
Вы также можете запустить слой перехода под названием Darling.
Он работает как WINE, которая создает среду перевода с Windows на Linux, которая позволяет вам запускать некоторые приложения Windows в системах Linux.
Darling пытается достичь той же цели между macOS и Linux.
Поскольку macOS и Linux совместно используют одну и ту же базу в стиле UNIX, Darling менее ресурсоемок, чем WINE, и в большинстве случаев дает лучшие результаты.
В настоящее время Darling может работать только с очень простыми приложениями с графическим интерфейсом и несколькими приложениями командной строки.
Хотя поддержка приложений с графическим интерфейсом является целью проекта, эта функция еще не реализована.
По сути, вы можете надежно запускать оболочку macOS в Терминале и, возможно, не сможете эффективно запускать другие приложения.
Он также содержит огромное количество кода, требующего около 12 гигабайт дискового пространства после сборки.
По сути, это дублирует функциональность операционной системы MacOS.
Поэтому, если вы беспокоитесь о том, что удаленные исполняемые файлы могут повредить вашу систему, вы можете избегать пакетов такого размера.
Сборка и установка дорогой Darling
1. Следуйте инструкциям по установке, чтобы загрузить правильные зависимости для вашего дистрибутива Linux со страницы установки Darling.
В зависимости от вашего дистрибутива вам может потребоваться выполнить длинную команду.
Например, для Ubuntu выполните следующую команду терминала, чтобы загрузить зависимости Darling:
Источник
How to Run Mac Apps on Linux
macOS and Linux share a common heritage. Unfortunately, that does not mean applications can smoothly transition between the operating systems. To run Mac apps on Linux, you’ll need some sort of virtual machine or translation layer.
Run a macOS Virtual Machine (All Apps)
The most reliable way to run Mac apps on Linux is through a virtual machine. With a free, open-source hypervisor application like VirtualBox, you can run macOS on a virtual device on your Linux machine. A properly-installed virtualized macOS environment will run all macOS apps without issue.
Virtualizing a desktop like this does require significant RAM, so it may not run smoothly on low-resource devices. For machines with the technical specs, virtualizing an operating systems through a VirtualBox virtual machine is the best option.
Using the Darling Translation Layer (CLI Only)
You can also run a translation layer called Darling. This works like WINE, which creates a Windows-to-Linux translation environment that allows you to run some Windows applications on Linux systems. Darling tries to accomplish the same goal between macOS and Linux. Because macOS and Linux both share the same UNIX-style base, Darling is less resource-intensive than WINE, producing better results in more circumstances.
For the time being, Darling can only work with very simple GUI apps and several command-line apps. While GUI app support is a goal for the project, the feature hasn’t yet been implemented. Basically, you can run a macOS shell in Terminal reliably and may or may not be able to run other apps effectively.
It also contains an enormous amount of code, requiring about 12 gigabytes of disk space after building. It’s essentially duplicating the functionality of the macOS operating system. So, if you worry about remote executables corrupting your system, you might want to avoid a package of this size.
Building and Installing Darling
1. Follow the installation instructions to download the correct dependencies for your Linux distro from the Darling Install page. Depending on your distro, you may need to run a lengthy command.
For example, for Ubuntu, run the following Terminal command to download Darling’s dependencies:
2. Clone Darling’s git depository to your local machine:
Источник
Linux program on mac
Lima: Linux virtual machines (on macOS, in most cases)
Lima launches Linux virtual machines with automatic file sharing, port forwarding, and containerd.
Lima can be considered as a some sort of unofficial «macOS subsystem for Linux», or «containerd for Mac».
Lima is expected to be used on macOS hosts, but can be used on Linux hosts as well.
✅ Automatic file sharing
✅ Automatic port forwarding
The goal of Lima is to promote containerd including nerdctl (contaiNERD ctl) to Mac users, but Lima can be used for non-container applications as well.
- Rancher Desktop: Kubernetes and container management to the desktop
- Colima: Docker (and Kubernetes) on macOS with minimal setup
- Lima xbar plugin — xbar plugin to start/stop VMs from the menu bar and see their running status.
Sharing files across macOS and Linux
Running containerd containers (compatible with Docker containers)
http://127.0.0.1:8080 is accessible from both macOS and Linux.
Install recent version of QEMU. v6.1.0 or later is recommended.
On ARM hosts, a patched version of QEMU has to be installed for enabling -accel hvf support.
The patch was merged into the master branch on 2021-09-21 and will be included in QEMU v6.2.0.
The patch is already cherry-picked in the Homebrew package of QEMU since 6.1.0_1 bottle.
- Download the binary archive of Lima from https://github.com/lima-vm/lima/releases , and extract it under /usr/local (or somewhere else). For instance:
- To install Lima from the source, run make && make install .
NOTE Lima is not regularly tested on ARM Mac (due to lack of CI).
Run limactl start to start the Linux instance. The default instance name is «default». Lima automatically opens an editor ( vi ) for reviewing and modifying the configuration. Wait until «READY» to be printed on the host terminal.
Run limactl shell to launch on Linux. For the «default» instance, this command can be shortened as lima . The lima command also accepts the instance name as the environment variable $LIMA_INSTANCE .
Run limactl copy . to copy files between instances, or between instances and the host. Use : to specify a source or target inside an instance.
Run limactl list [—json] to show the instances.
Run limactl stop [—force] to stop the instance.
Run limactl delete [—force] to delete the instance.
To enable bash completion, add source to
⚠️ CAUTION: make sure to back up your data
Lima may have bugs that result in loss of data.
Make sure to back up your data before running Lima.
Especially, the following data might be easily lost:
- Data in the shared writable directories ( /tmp/lima by default), probably after hibernation of the host machine (e.g., after closing and reopening the laptop lid)
- Data in the VM image, mostly when upgrading the version of lima
The current default spec:
- OS: Ubuntu 21.04 (Hirsute Hippo)
- CPU: 4 cores
- Memory: 4 GiB
- Disk: 100 GiB
- Mounts:
(read-only), /tmp/lima (writable)
- Hypervisor: QEMU with HVF accelerator
- Filesystem sharing: reverse sshfs (planned to be replaced with 9p soon)
- Port forwarding: ssh -L , automated by watching /proc/net/tcp and iptables events in the guest
Contributing to Lima
Please certify your Developer Certificate of Origin (DCO), by signing off your commit with git commit -s and with your real name.
Please squash commits.
- Test on ARM Mac
- Performance optimization
- More guest distros
- Windows hosts
- GUI with system tray icon (Qt or Electron, for portability)
- VirtFS to replace the current reverse sshfs (work has to be done on QEMU repo)
- vsock to replace SSH (work has to be done on QEMU repo)
«What’s my login password?»
Password is disabled and locked by default. You have to use limactl shell bash (or lima bash ) to open a shell.
Alternatively, you may also directly ssh into the guest: ssh -p 60022 -i
/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes 127.0.0.1 .
«Does Lima work on ARM Mac?»
Yes, it should work, but not regularly tested on ARM (due to lack of CI).
«Can I run non-Ubuntu guests?»
Debian, Fedora, Alpine, Arch Linux, and openSUSE are also known to work. See ./examples/ .
An image has to satisfy the following requirements:
- systemd or OpenRC
- cloud-init
- The following binaries to be preinstalled:
- sudo
- The following binaries to be preinstalled, or installable via the package manager:
- sshfs
- newuidmap and newgidmap
- apt-get , dnf , apk , pacman , or zypper (if you want to contribute support for another package manager, run git grep apt-get to find out where to modify)
«Can I run other container engines such as Docker and Podman?»
Yes, any container engine should work with Lima.
The default Ubuntu image also contains LXD. Run lima sudo lxc init to set up LXD.
«Can I run Lima with a remote Linux machine?»
Lima itself does not support connecting to a remote Linux machine, but sshocker, the predecessor or Lima, provides similar features for remote Linux machines.
e.g., run sshocker -v /Users/foo:/home/foo/mnt -p 8080:80 @ to expose /Users/foo to the remote machine as /home/foo/mnt , and forward localhost:8080 to the port 80 of the remote machine.
«Advantages compared to Docker for Mac?»
Lima is free software (Apache License 2.0), while Docker for Mac is not. Their EULA even prohibits disclosure of benchmarking result.
On the other hand, Moby, aka Docker for Linux, is free software, but Moby/Docker lacks several novel features of containerd, such as:
«QEMU crashes with HV_ERROR «
If you have installed QEMU v6.0.0 or later on macOS 11 via homebrew, your QEMU binary should have been already automatically signed to enable HVF acceleration.
However, if you see HV_ERROR , you might need to sign the binary manually.
EOF codesign -s — —entitlements entitlements.xml —force /usr/local/bin/qemu-system-x86_64 «>
Note: Only on macOS versions before 10.15.7 you might need to add this entitlement in addition:
- Make sure that HVF is enabled with com.apple.security.hypervisor entitlement. See «QEMU crashes with HV_ERROR «.
- Emulating non-native machines (ARM-on-Intel, Intel-on-ARM) is slow by design.
- make sure qemu is codesigned, See «QEMU crashes with HV_ERROR «.
- if you are on macOS 10.15.7 or 11.0 or later make sure the entitlement com.apple.vm.hypervisor is not added. It only works on older macOS versions. You can clear the codesigning with codesign —remove-signature /usr/local/bin/qemu-system-x86_64 and start over.
«Port forwarding does not work»
Prior to Lima v0.7.0, Lima did not support forwarding privileged ports (1-1023). e.g., you had to use 8080, not 80.
Lima v0.7.0 and later supports forwarding privileged ports on macOS hosts.
On Linux hosts, you might have to set sysctl value net.ipv4.ip_unprivileged_port_start=0 .
stuck on «Waiting for the essential requirement 1 of X: «ssh»
libslirp v4.6.0 used by QEMU is known to be broken. If you have libslirp v4.6.0 in /usr/local/Cellar/libslirp , you have to upgrade it to v4.6.1 or later ( brew upgrade ).
«permission denied» for limactl cp command
The copy command only works for instances that have been created by lima 0.5.0 or later. You can manually install the required identity on older instances with (replace INSTANCE with actual instance name):
«Cannot access the guest IP 192.168.5.15 from the host»
The default guest IP 192.168.5.15 is not accessible from the host and other guests.
To add another IP address that is accessible from the host and other virtual machines, enable vde_vmnet .
«Hints for debugging other problems?»
- Inspect logs:
- limactl —debug start
- $HOME/.lima/ /serial.log
- /var/log/cloud-init-output.log (inside the guest)
- /var/log/cloud-init.log (inside the guest)
- Make sure that you aren’t mixing up tabs and spaces in the YAML.
About
Linux virtual machines, on macOS (aka «Linux-on-Mac», «macOS subsystem for Linux», «containerd for Mac», unofficially)
Источник