A information to getting your MacBook prepared for ML growth
[Updates 3 July 2022: Added section on Chrome Extensions]
Remap Caps Lock
key to Esc key
I do that for each keyboard that I setup, even for the in-built MacBook keyboard. To remap, go to System Preferences > Keyboard > Modifier Keys
. As a result of VIM makes use of Esc
to exit a mode, it is just too inefficient to maneuver your finger to the Esc
key, therefore I changed it with Caps Lock
. Belief me — its a life-changer.
Take away all pointless functions from dock and conceal it
Come on guys, Highlight (⌘ area
) can open every part you want. There’s no have to click on in your dock. Right here’s what my minimalist dock appears to be like like.
Trackpad
My choice is to maintain my monitoring pace at about 2 marks from the right-most (quickest) choice. You may modify these settings from System Preferences > TrackPad > Level & Click on
.
I can’t emphasize how essential it’s to get this package deal supervisor for MacOS. It manages (set up, replace, delete) all of the packages that you simply want that Apple didn’t pre-install for you.
To put in it, open the Terminal and run:
/bin/bash -c "$(curl -fsSL https://uncooked.githubusercontent.com/Homebrew/set up/grasp/set up.sh)"
After set up, now you can set up packages utilizing brew set up <pkg_name>
. To improve packages, use brew improve <pkg_name>
and at last to delete packages, use brew uninstall <pkg_name>
.
We’ll use brew
to put in some packages under.
In his article, Vinicius talked about iTerm2 as an optionally available substitute for Mac’s built-in Terminal. In all honesty, it’s a compulsory substitute for me. Try the variations:
I don’t learn about you however the right-hand aspect terminal appears to be like a lot extra horny visually, not to mention the utilization of it.
To put in, run the next within the Terminal:
brew set up --cask iterm2
From this level onwards, iTerm2 will change the Terminal software without end. Bid your farewells to Terminal.
You have to be questioning — “Hey, I’ve put in iTerm2 however it’s nowhere as horny as yours, David.” Fret not my youngster, right here’s what you put in subsequent.
There’s a purpose why oh my zsh has 147k stars. It’s completely important to any developer because it comprises a whole lot of plugins and themes to configure your zsh.
To put in oh my zsh, run the next in iTerm2:
sh -c "$(curl -fsSL https://uncooked.githubusercontent.com/ohmyzsh/ohmyzsh/grasp/instruments/set up.sh)"
Subsequent, set up the powerlevel10k theme. (Sure, I do know there are lots of themes on the market however I extremely extremely extremely suggest this one!) It’s tremendous simple to setup and tremendous horny to have in your terminal with good fonts and icons.
To put in it, we’ll use brew
as soon as once more (there are lots of different set up choices listed on the git repo):
brew set up romkatv/powerlevel10k/powerlevel10k
echo "supply $(brew --prefix)/decide/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
To configure p10k to attain the look above, run the next in iTerm2 and observe by means of the set up wizard to customise to your individual liking:
p10k configure
Oh My Zsh Plugins
The ability of oh my zsh comes from all of the plugins that may be added to your shell expertise. Right here’s what I’d minimally set up:
zsh-autosuggestions
— We concern a whole lot of instructions on the command line on a regular basis. This plugin helps to autosuggest instructions you’ve beforehand used earlier than and you may settle for the suggestion utilizing the → key. That is particularly helpful once you can not bear in mind a precise command or you could have an extended command that you simply want to modify. To put in:
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
zsh-syntax-highlighting
— This plugin provides color to the instructions you’re typing. Say goodbye to boring white textual content by putting in it utilizing:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/customized}/plugins/zsh-syntax-highlighting
After putting in customized plugins, we are able to allow them by including it to the checklist of plugins to load in $HOME/.zshrc
:
Be aware: Customized plugins are put in at
$HOME/.oh-my-zsh/customized/plugins
.
Shell Aliases
To hurry up instructions on the terminal, we at all times want aliases. It reduces key strokes and makes builders extra environment friendly. For me, I write all my aliases in $HOME/.native/embody
and embody this snippet in $HOME/.zshrc
.
# .zshrc
for file in $HOME/.native/embody/*;
do supply $file
achieved
Within the folder $HOME/.native/embody
, you possibly can embody shell scripts together with your aliases. For example:
# File: my_aliases.sh# Apple system associated
alias turnonbt='blueutil --power 1'
alias turnoffbt='blueutil --power 0'
alias turnoffsleep='sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1'
alias turnonsleep='sudo pmset -a sleep 1; sudo pmset -a hibernatemode 3; sudo pmset -a disablesleep 0'# Git
alias gpom='git pull origin grasp'
alias gmo='git merge origin'
alias gc='git checkout'
alias gs='git standing'
alias gcm='git commit -m'
alias ga='git add'
alias gb='git department'
alias gf='git fetch'
alias gp='git pull'
alias gr='git restore'
alias push='git push origin'
alias pull='git pull origin'
alias stash='git stash'
alias sapply='git stash apply'# Docker
alias di='docker photos checklist'
alias dcp='docker container prune -f'
alias di='docker photos'
alias dpa='docker ps -a'
alias dp='docker pull'
alias drf='docker rmi -f'
alias dsp='docker system prune -f'# Different examples
alias tf='terraform'
alias kcl='kubectl'
...
BONUS: join MacBook to an exterior show with display lid closed WITHOUT connecting energy adapter:
I’m unsure in case you guys have tried to attach your closed laptop computer to an exterior with no energy adapter, however I certain have. This command was a real life-saver:
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1
The trick right here is to disable sleep. Doing so will blur out the choice of sleeping your laptop computer, permitting you to shut your laptop computer and plug it to an exterior show:
To make your life less complicated, let’s flip it into an alias to disable and allow it every time it is advisable:
# to disable sleep
alias turnoffsleep='sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1'# to allow sleep
alias turnonsleep='sudo pmset -a sleep 1; sudo pmset -a hibernatemode 3; sudo pmset -a disablesleep 0'
Different functions to put in utilizing Homebrew
- Docker:
brew set up --cask docker
(for Apple silicon Macs, please obtain it from right here as a substitute) - Git:
brew set up git
- Kubectl:
brew set up kubectl
- VScode:
brew set up --cask visual-studio-code
. Now you can open VSCode from the command line utilizingcode <dir>
. For instance, to open VSCode within the present listing, usecode .
. - Blueutil:
brew set up blueutil
This nifty software helps you handle your system bluetooth through CLI! When you’re like me who desires to do every part through keyboard, you’d positively want this. - htop:
brew set up htop
That is an interactive course of viewer that lets you see what processes are operating in your system. It exhibits you the PID, reminiscence, cpu utilization and rather more!
Pip
pip
(Python’s package deal supervisor) ought to already be put in in your system. To replace it:
pip set up -U pip
Conda
I like to put in conda
as effectively as a result of another initiatives handle dependencies utilizing conda
. To put in, go to its official website right here because it comprises completely different variations for Intel and Apple Silicon Macs.
Pyenv
As we don’t wish to use the system’s in-built Python2, I normally set up one other Python setting supervisor like pyenv
. Be cautious although, as putting in a number of of those will try to switch your $PATH
variable.
brew replace
brew set up pyenv
All the time verify which Python interpreter you’re utilizing in case you’re not sure.
which python
To put in sure variations of Python, use:
pyenv set up <py_version>
pyenv world <py_version> # set world model
Extensions
Right here’s a non-exhaustive checklist of extensions that I should set up for my day-to-day work:
- Docker [ms-azuretools.vscode-docker]
- GitLens [eamodio.gitlens]
- Jinja [wholroyd.jinja]
- Jupyter [wholroyd.jinja]
- Kubernetes [ms-kubernetes-tools.vscode-kubernetes-tools]
- Pylance [ms-python.vscode-pylance]
- Distant-ssh [ms-vscode-remote.remote-ssh]
- Distant-containers [ms-vscode-remote.remote-containers]
- Thunder Consumer [rangav.vscode-thunder-client]
- VIM [vscodevim.vim]
- YAML [redhat.vscode-yaml]
- HashiCorp Terraform [4ops.terraform]
- autoDocstring — Python Docstring Generator [njpwerner.autodocstring]
Compatibility with Oh My Zsh
As a result of we’re utilizing zsh as our default shell, we have now to make some adjustments to the settings with a purpose to view the font and icons on the VSCode terminal.
Open File → Preferences → Settings (PC) or Code → Preferences → Settings (Mac), enter terminal.built-in.fontFamily
within the search field on the prime of Settings tab and set the worth under to MesloLGS NF
[3]. See GIF under for a fast information.
Themes, Icons, Fonts/Ligatures
- One Darkish Professional [zhuangtongfa.material-theme]
- Materials Theme [Equinusocio.vsc-material-theme] — I take advantage of this!
- Materials Theme Icons [equinusocio.vsc-material-theme-icons] — I take advantage of this!
- Fira Code font (comes with ligatures!) because the editor font household. See the way it appears to be like like under:
To put in Fira Code, run the next instructions:
brew faucet homebrew/cask-fonts
brew set up --cask font-fira-code
After which, allow this font on VSCode by:
- Enabling ligatures — modify
editor.fontLigatures
in settings.json totrue
- Modifying the
editor.fontFamily
toFira Code
Magnet [Paid]
The one paid app you ever want on the Mac and it’s life-changing. It merely snaps home windows into place. Sure, Home windows have this function without cost however hey, we’re Apple customers. Gotta pay that premium.
Now, let’s see it in motion.
Postico
My go to database shopper for PostgreSQL. Set up it right here.
Postman
My different go to shopper for API testing apart from Thunder Consumer (put in above as a VSCode extension). Set up it right here and select your Mac model.
Others
I don’t normally promote {hardware} in any respect, however I’ve been utilizing the MX Grasp mouse collection for about 5 years (sure, I’ve been utilizing the 2S for that lengthy!) and it’s been completely life altering, particularly in case you personal a Mac.
If there’s one {hardware} you must get to accompany your Mac, it needs to be this.
Three fingers to swipe-left/proper, 4 finger swipes, two finger scrolls and different trackpad gestures — that’s means an excessive amount of of a trouble, particularly when your MacBook is plugged in to a monitor and utilizing an exterior keyboard/mouse.
With the MX Grasp, all of the Mac gestures may be assigned to the mouse. Right here’s how I customise mine:
- Use the again & ahead buttons to toggle between Desktop home windows
- Use the gesture button to swipe away present home windows
- Connect with a number of machines/gadgets to switch information (additionally the cursor strikes from one machine to the opposite! Often known as Movement)
After all, there are different options that are tremendous glossy together with a trouble free toggle between free-spinning scroll and line-by-line scrolling, capability to work on virtually all surfaces, horizontal scroll and lots of extra.
I’d positively be wanting ahead to my improve from the MX Grasp 2S to the MX Grasp 3S.
As engineers (and likewise for leisure 🙂), watching movies allow us to be taught rapidly. This extension lets you management the pace of the movies taking part in in your browser (together with YouTube) utilizing your keyboard.
d
: Pace up video by 0.1s
: Decelerate video by 0.1
For fellow Vim n3rds, this can be a must-have. Do take be aware that on some internet pages (e.g., Google Docs), you may wish to disable this extension — you are able to do so by including it to the exclusion checklist.
This extension lets you flip ANY internet web page into darkish mode. Who doesn’t like darkish mode, proper?
Conveniently entry the codes in your authenticator app on the browser.
What are a number of the must-dos once you’re establishing a brand new MacBook? Let me know within the feedback!
Assist me! — When you like my content material and are not subscribed to Medium, do contemplate supporting me and subscribing through my referral hyperlink right here (NOTE: a portion of your membership charges might be apportioned to me as referral charges).
[1] Sourabh Bajaj — Mac Setup
[2] Set Up Your Mac for Internet Growth in 2021 —
Vinicius De Antoni
[3] Powerlevel10k GitHub Set up Information