content/blog/2024-05-03-ubuntu-on-macos.org
102 lines · 3976 bytes
1#+date: <2024-05-03 Fri 00:00:00>
2#+title: Deployment Instructions for Running Ubuntu Linux on macOS Using OrbStack
3#+description: Technical guide outlining the installation and operation of OrbStack to run Ubuntu Linux containers natively on macOS systems with performance considerations.
4#+slug: ubuntu-on-macos
5#+filetags: :linux:macos:orbstack:
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[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/create.png]]
37
38** Launching the Machine
39
40Once created, the dialog will close and you will be presented with your new list
41of machines. Simply double-click on a machine to run it.
42
43When you run the machine for the first time, it may warn you that a program is
44attempting to run a shell script. You can choose to manually inspect this shell
45script via the provided path if you wish. When you're comfortable with the
46script, you can toggle the =Suppress this message permanently= button and click
47OK to run the machine.
48
49#+begin_quote
50*Quick Tip*!
51
52You will always be able to launch the OrbStack application and control the
53machine via the Machines page, but you can also use the OrbStack icon in the
54macOS menu bar to quickly control the machine without launching OrbStack itself.
55#+end_quote
56
57** Working in Linux
58
59Once successful, OrbStack will launch your default terminal and log you into the
60Linux machine you created above.
61
62In the example below, we can see that the machine is using =Linux ubuntu 6.9.6=
63and operates similar to a fresh Ubuntu install on bare metal.
64
65#+caption: Ubuntu CLI
66[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/cli.png]]
67
68You can also click the machine's folder icon in OrbStack to open the machine's
69file system within macOS's native Files app. Within Files, you can double-click
70to open any files and they will open in the macOS defaults for those file types
71(e.g., TextEdit).
72
73#+caption: Ubuntu Files
74[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/files.png]]
75
76Here's an example of opening the =test.md= file in the screenshot above, which
77defaults to opening in Xcode on my system.
78
79#+caption: Ubuntu Files
80[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/xcode.png]]
81
82*** Test Examples
83
84As a quick example of the system, I installed =neofetch=, switched to the =zsh=
85shell, and ran a few common commands.
86
87#+caption: Test Examples
88[[https://img.cleberg.net/blog/20240503-ubuntu-on-macos/test.png]]
89
90** Thoughts
91
92The installation, creation, and launch processes are seamless and provide an
93easy way to test or use Linux on macOS with little to no hassle.
94
95The shell and file integrations are incredibly snappy and I have not
96experienced any lag so far. Further, being able to open files in the
97Files app allows for me to use macOS native applications, such as
98TextEdit for quick editing without having to resort to other programs
99that may not be as familiar to macOS users.
100
101I love this method and will be happily looking for further use cases to
102apply.