cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

main: content/blog/2024-05-03-ubuntu-on-macos.org · raw

  1#+date:        [2024-05-03 Fri 00:00:00]
  2#+title:       OrbStack on macOS: Running Ubuntu
  3#+description: Running a full Ubuntu environment on macOS using OrbStack.
  4#+slug:        ubuntu-on-macos
  5#+filetags:    :linux:
  6
  7Being a macOS user who previously used Linux for many years, I often find myself
  8searching for alternatives to the Linux-native tools and methods that I had
  9become used to over the years.
 10
 11Luckily, there's an option to simply use Linux directly on your macOS device
 12without having to boot the whole device into Linux or having to SSH into another
 13Linux machine.
 14
 15In this post, I use [[https://orbstack.dev/][OrbStack]] to create an Ubuntu Linux machine to take advantage
 16of the Linux system.
 17
 18** Installing OrbStack
 19
 20OrbStack has a [[https://orbstack.dev/download][download page]] if you prefer to use =*.dmg= files to install
 21applications.
 22
 23Personally, I prefer to install everything through Homebrew. For OrbStack, run
 24the following to install the application via Homebrew:
 25
 26#+begin_src sh
 27brew install orbstack
 28#+end_src
 29
 30** Creating a Linux Machine
 31
 32Once installed, you can launch OrbStack and create a Linux machine in a matter
 33of seconds. The creation dialog defaults to Ubuntu.
 34
 35#+caption: OrbStack's Linux Machine Creation Page
 36#+attr_html: :alt A popup within OrbStack to create a new machine with a custom name, distribution, version, and CPU type.
 37[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/create.webp]]
 38
 39** Launching the Machine
 40
 41Once created, the dialog will close and you will be presented with your new list
 42of machines. Simply double-click on a machine to run it.
 43
 44When you run the machine for the first time, it may warn you that a program is
 45attempting to run a shell script. You can choose to manually inspect this shell
 46script via the provided path if you wish. When you're comfortable with the
 47script, you can toggle the =Suppress this message permanently= button and click
 48OK to run the machine.
 49
 50#+begin_quote
 51*Quick Tip*!
 52
 53You will always be able to launch the OrbStack application and control the
 54machine via the Machines page, but you can also use the OrbStack icon in the
 55macOS menu bar to quickly control the machine without launching OrbStack itself.
 56#+end_quote
 57
 58** Working in Linux
 59
 60Once successful, OrbStack will launch your default terminal and log you into the
 61Linux machine you created above.
 62
 63In the example below, we can see that the machine is using =Linux ubuntu 6.9.6=
 64and operates similar to a fresh Ubuntu install on bare metal.
 65
 66#+caption: Ubuntu CLI
 67#+attr_html: :alt An example of the Ubuntu CLI, running the "uname -a" command.
 68[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/cli.webp]]
 69
 70You can also click the machine's folder icon in OrbStack to open the machine's
 71file system within macOS's native Files app. Within Files, you can double-click
 72to open any files and they will open in the macOS defaults for those file types
 73(e.g., TextEdit).
 74
 75#+caption: Ubuntu Files
 76#+attr_html: :alt The Ubuntu machine's files available within the macOS Files app.
 77[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/files.webp]]
 78
 79Here's an example of opening the =test.md= file in the screenshot above, which
 80defaults to opening in Xcode on my system.
 81
 82#+caption: Ubuntu Files
 83#+attr_html: :alt An example of editing the test.md file in Xcode.
 84[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/xcode.webp]]
 85
 86*** Test Examples
 87
 88As a quick example of the system, I installed =neofetch=, switched to the =zsh=
 89shell, and ran a few common commands.
 90
 91#+caption: Test Examples
 92#+attr_html: :alt An example of the date, pwd, and neofetch commands.
 93[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/test.webp]]
 94
 95** Thoughts
 96
 97The installation, creation, and launch processes are seamless and provide an
 98easy way to test or use Linux on macOS with little to no hassle.
 99
100The shell and file integrations are incredibly snappy and I have not
101experienced any lag so far. Further, being able to open files in the
102Files app allows for me to use macOS native applications, such as
103TextEdit for quick editing without having to resort to other programs
104that may not be as familiar to macOS users.
105
106I love this method and will be happily looking for further use cases to
107apply.