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