Commit e2050447e2

e2050447e27692ae70a82bae339c8ea46072e013

parent: 3e976d345a

Unsigned

cmc <hello@cleberg.net> · 2024-05-03 18:58 UTC

add ubuntu-on-macos blog post

Layout: unified · split

content/blog/2024-05-03-ubuntu-on-macos.md added +100
@@ -0,0 +1,100 @@
1+++
2date = 2024-05-03
3title = "Running Ubuntu Linux on macOS with OrbStack"
4description = "Learn how to run Linux machines as applications on macOS with minimal hassle."
5draft = false
6+++
7
8Being a macOS user who previously used Linux for many years, I often find myself
9searching for alternatives to the Linux-native tools and methods that I had
10become used to over the years.
11
12Luckily, there's an option to simply use Linux directly on your macOS device
13without having to boot the whole device into Linux or having to SSH into another
14Linux machine.
15
16In this post, I use [OrbStack](https://orbstack.dev/) to create an Ubuntu Linux
17machine to take advantage of the Linux system.
18
19## Installing OrbStack
20
21OrbStack has a [download page](https://orbstack.dev/download) if you prefer to
22use `*.dmg` files to isntall applications.
23
24Personally, I prefer to install everything through Homebrew. For OrbStack, run
25the following:
26
27```sh
28brew install orbstack
29```
30
31## Creating a Linux Machine
32
33Once installed, you can launch OrbStack and create a Linux machine in a matter
34of seconds. This creation module defaults to Ubuntu.
35
36![OrbStack's Linux Machine Creation
37Page](https://img.cleberg.net/blog/20240503-ubuntu-on-macos/create.png)
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
44![OrbStack Machines
45List](https://img.cleberg.net/blog/20240503-ubuntu-on-macos/machine.png)
46
47When you run the machine for the first time, it may warn you that a program is
48attempting to run a shell script. You can choose to manually inspect this shell
49script via the provided path, if you wish. When you're comfortable with the
50script, toggle the `Suppress this message permanently` button and click OK to
51run the machine.
52
53![First-Time Run
54Warning](https://img.cleberg.net/blog/20240503-ubuntu-on-macos/warning.png)
55
56You will always be able to launch the OrbStack application and control the
57machine via the Machines menu, but you can also use the OrbStack icon in the
58macOS menu bar to quickly control the machine without launching OrbStack itself.
59
60## Working in Linux
61
62Once successful, OrbStack will launch your default terminal and log you into the
63Linux machine you created above.
64
65In the example below, we can see that the machine is using `Linux ubuntu 6.7.11`
66and operates similar to a fresh Ubuntu install on bare metal.
67
68![Ubuntu CLI](https://img.cleberg.net/blog/20240503-ubuntu-on-macos/cli.png)
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![Ubuntu Files](https://img.cleberg.net/blog/20240503-ubuntu-on-macos/files.png)
76
77Here's an example of opening the `test.md` file in the screenshot above, which
78defaults to opening in Xcode on my system.
79
80![Ubuntu Files](https://img.cleberg.net/blog/20240503-ubuntu-on-macos/xcode.png)
81
82
83### Test Examples
84
85As a quick example of the system, I added a `test` user, installed `neofetch`,
86and switched the `test` user's shell to `zsh`:
87
88![Test Examples](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 experienced
96any lag so far. Further, being able to open files in the Files app allows for me
97to use macOS native applications, such as TextEdit for quick editing without
98having to resort to other programs that may not be as familiar to macOS users.
99
100I love this method and will be happily looking for further use cases to apply.