Hey folks, I’ve been wanting to write an article on this topic for a long time but always find myself stuck with something or the other. Mostly because a lot of things have changed lately and it takes time to find the lost balance. So finally, I got some time out to craft this article for you.
It is good that you are putting some time aside to actually read about setting your machine.
Most people directly jump in and make all sorts of mess and end up spending more time into cleaning rather than doing the actual thing. And this is really important because undoing a lot of wrong stuff afterwards takes away your crucial time. So it is better you start on the right path.
Enough chit chat, let’s get to the business.
Table of Contents
Setting Up Your Mac Machine
Let’s start setting up your Mac machine.
Configure The Trackpad: Tap to Click
When I first used Mac, the trackpad behaved differently. I had to physically press the entire trackpad just to record a click. And with every press trackpad life shortens.
It is always good to change the settings of your trackpad to “tap to click”.
To change the settings of your trackpad, follow these steps:
- Click on the apple icon at the top left side of your screen.
- Select System Preferences
- Click on Trackpad
- Check the boxes that say “Tap to click” and “Secondary Click”. (See Image Below)
Configure The Trackpad: Enable Dragging
Another thing that felt odd was I was not able to drag the icons around without pressing on the trackpad.
Again this was something that I did not like. I was accustomed to dragging the icon by double-click + hold and move it kind of style.
And also it prevents the hard pressing of the trackpad. Therefore, I recommend you to “Enable Dragging” as well.
To enable dragging, follow these steps:
- Go to System Preferences.
- Click on Accessibility.
- Click on Mouse & Trackpad option from the left.
- Click on Trackpad Options…
- Check the Enable Dragging option in the dialog box that pops up (see the image below).
This will allow you to double-tap the icon and drag it around the window.
Now let’s talk about setting your Mac Machine for Development.
Setting Up Mac Machine For Development
XCode
First thing first, install the Xcode Command Line Tools by firing below command in your terminal.
xcode-select --install
You will need this tool to enable other tools to work efficiently with your machine. You will be installing those tools next.
Setting Up Homebrew
Homebrew is a package manager that helps you to install software on your machine.
But that is not the only thing it is used for.
Homebrew is a perfect tool to keep your machine clean and free of smells.
As time pass, your machine is filled up with all those software and tools which are no longer in use. And that can lead to slowing down of your machine.
Or sometimes your machine crash, if data is important for you then hopefully you backup all your data in the cloud, but what about the software and apps that are there on your machine. There is no easy way to backup all of that.
Installing every single app one-by-one is a really boring task. So why not automate it, right?
This is where Homebrew comes for the rescue.
Just with one command, you can set up your entire machine right back where you want it.
To do that all you need to do is execute below command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This command will download and install the Homebrew on your machine.
Now execute the following command:
brew bundle dump
It will create a file named Brewfile and dump all the packages that are installed on your machine using brew. And you will be able to manage every software by using brew commands.
Following is my Brewfile. Feel free to copy it and edit it.
What you see in the file is the list of software that is currently installed on my machine. If you want to install all the softwares all you need to do is execute the following command:
brew bundle
This small command will look through the Brew file and install all the necessary packages.
Just like your data, now you can also backup all your software on cloud. And whenever you need it, simply install Brew and run brew bundle. Everything will be taken care of by brew itself.
Tip: Make it a habit to install software via Brewfile so that your Brewfile remains updated all the time.
Where are the packages installed?
All the packages are installed under usr/local/Cellar
. Here are all the packages that are installed on my machine:
~ ls /usr/local/Cellar
asdf diff-so-fancy gmp libyaml pcre tomcat@8 xz
autoconf direnv icu4c maven pcre2 tree
automake gawk jenv mpfr pkgdiff unixodbc
binutils gdbm libtool node python unzip
coreutils gettext libxml2 openssl readline watchman
curl git libxslt openssl@1.1 sqlite wdiff
Find the Brew Cheatsheet:
Cleaning Up Your Machine
With Brew, you can not only install new software but also keep your software updated.
To upgrade all the packages at once, type following command:
# To upgrade all packages
brew upgrade
# To upgrade individual package
brew upgrade <package_name>
To remove all the packages that are not present in the Brewfilw, type following command:
# To list packages that will be uninstalled
brew bundle cleanup
# To uninstall all the listed packages
brew bundle cleanup --force
The cleanup feature of the brew is helpful for testers or maintainers who frequently install a lot of software. It becomes difficult for them to keep track of all the unused software and that’s where Brew cleanup is very helpful.
Clearing Up Cache and Other Stale Files
There are many paid software out there that will give you a nice way to clear all your stale cache files. But if you could live without fancy UI and your objective is just to clear cache files then I have a custom cleanup script for you.
Code Link: https://github.com/vslala/SVAG/blob/master/gists/bash/macos-cleanup-script.sh
You can download the file and put in your home directory. The easy way to execute the script is using the following command: sh macos-cleanup-script.sh
.
But I would recommend you create an alias to this file, that way you wouldn’t have to remember the name of the file or the location where it is kept. For creating an alias, you can do something like this in your .bash_profile or .zshrc file (profile file):
alias cleanup="sh ~/macos-cleanup-script.sh"
That’s you would just have to call cleanup
from your terminal and the script will execute.
Increase productivity with keyboard shortcuts
This will come handy especially for a developer. A developer always has a train of thoughts running in this mind, and reaching out for a mouse could take an eternity.
So, why not leverage the keyboard shortcuts that can actually save you more than 10 minutes in an hour of work.
My colleague has written a short and crisp article on the same. She has talked about the command keyboard shortcuts that could increase your productivity from day one. Here’s the link to the article:
Conclusion
Go through the list of all the packages that are mentioned in the Brewfile I shared with you above. It contains most of the software and tools used by Java developer.
Let me know what do you think of this article.