Hey there awesome internet people, I’m back with another blog post. This time I’ll be talking about how to set up a macOS like setup on Ubuntu/Linux. I’ll be using Ubuntu 22.04 as my OS of choice, but the steps should be similar for any other Linux distro.
What’s the problem?
Recently I had upraded my old Windows laptop with an extra 16gigs of latest supported RAM. I was using Windows 10 on it as the processor was 7th gen and it limited me to it, so instead of bypassing Windows 11 checks, I thought why not switch to linux. As most times Windows makes it hard to setup a smooth dev environment for multiple languages/frameworks anyways, which made me earlier do hacks to get to a closest of somewhat working setup. The recent windows subsystem linux did bring some hope, but I was still not satisfied with it.
On the other hand, I primarily use macOS on my 16” MacBook Pro, and ever so I am used to the buttery smooth Homebrew experience on macOS. So I decided to give Ubuntu a try, it being the closest linux distro with good support for most apps.
Installing Ubuntu from a USB drive
First things first, I downloaded a fresh copy of Ubuntu Desktop from their site v22.04.02 LTS at the time of writing this and installed it on my laptop.
I did have a few issues with FAT32 file system at the installation such as some packages missing in the installation media, but I was able to get through it.
If you are also installing it from a FAT16/32 file system, I suggest you to check the below list for possible solutions -
- Use Rufus to create a bootable USB drive for Ubuntu.
- Install missing packages in the “Try live” mode using
sudo apt install dosfstools mtools
orsudo apt-get install dosfstools mtools
. - Select something else at Installtion Type step and then create the below partitions:
- 1st partition: 512MB/1024MB, type: Linux filesystem, mount point: /boot
- 2nd partition: 40% of your entire disk space, type: Linux filesystem, mount point: /
- 3rd partition: Same size as your available RAM or more, type: Linux swap, use as: swap area
- 4th partition: 45% of your entire disk space, type: Linux filesystem
That should do it for the installtion part. Now let’s get to the fun part.
What is a macOS like setup?
I’m been a macOS user since the past 3+ years now, and I’ve used it extensively on tooling for multiple languages and frameworks such as PHP, Javascript, Flutter and more. So I’ll be talking about the things I’ve seen and used on macOS and how to get them on Ubuntu.
Homebrew
Homebrew is a package manager for macOS, and it’s the best one out there. It’s so easy to install and use, and it’s the best way to install any package on macOS. I never had any issues all these years with it being my side.
So, how do we get it on Ubuntu? Well, there’s a project called Linuxbrew which is a fork of Homebrew for Linux. It’s a community maintained project and it’s pretty good. It’s not as good as Homebrew on macOS, but it’s good enough to get the job done.
Requirements include -
- Glibc 2.13 or newer
- A Linux kernel 3.2 or newer
- A 64-bit processor
- And a few other build packages
- build-essential
- curl
- file
- git
- procps
To install these build packages run the following command in your terminal -
sudo apt-get install build-essential curl file git procps
Installing Linuxbrew aka Homebrew on Ubuntu
To install it, run the following command in your terminal -
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
and then run this -
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile
This will install Homebrew on your system and add Homebrew to your PATH and to your bash shell profile script. You can check the installation by running brew doctor
in your terminal. It should show you a message like this -
Your system is ready to brew.
Most commonly used macOS packages are
Some of the most commonly used packages on macOS that makes day to day development easy are -
To install any of these packages, run the following command in your terminal -
brew install <package-name>
Conclusion
I can keep going on how to setup these stacks, but I’ll leave it to you to figure out. I’ll be writing more blog posts on how to setup some of these stacks in the future. If you have any questions, feel free to reach out to me on Twitter.