I was overdue for an upgrade at my day job and recently received a 16 inch M1 Macbook Pro. If you work at Tech Company as a developer, you get provided a laptop for your daily development needs. Each company is different, but the typical time for a laptop refresh is about every 2-4 years. I contemplated what improvements I could make to my developer environment now that starting from a clean install. I wanted to share two changes I made with you.
Oh My ZSH
One thing to note is that the M1 mac was first announced in November of 2020 with zsh as the default shell. The previous version of bash shipped on mac had not been updated since 2007.
My usual strategy for setting up new dev machines is to copy my bashrc and bash_profile over the configs I've built up for the past nine years. Because the default environment is now zsh, I saw an opportunity to research some different tooling.
Oh My Zsh is a framework that has been around for some time and built on top of zsh. It is structured to allow plugins and themes and provide some basic shell environment settings from the start. With ease, you can leverage 275 plugins to install things like Go and Rust into your environment path.
Oh My Zsh is a delightful experience with a large open source community to help drive the framework forward. It comes bundled with thousands of helpful functions, helpers, plugins, and themes.
Some plugins worth looking into are the aws cli plugin for managing multiple profiles and framework-specific plugins like flutter for completion and aliases.
Volta
My go-to for Node version management had been nvm for years, it works how I expect it to, and I've never considered using anything else until now. You see, my expectations have been coerced into where they are today because I was able to learn Node the hard way (on the job). I never allowed the brain cycles to think about tooling, but while setting up my environment with an audience on Twitch, Volta came up as an alternative to my reach for nvm. I had t try it.
Volta is built in Rust and ships as a snappy static binary, which means you can install and run any JS tool quickly and seamlessly.
With Volta, you can select a Node engine once and lose the need to manage to load the correct version constantly. This was always a challenge for me when working on multiple projects in different terminals. In my past experiences, the version did not always line up, and I needed to include a nvm use command
in my bash_profile to load the right Node when opening the terminal. Volta prevents that and the need to reinstall Node version on every upgrade.
Volta has a seamless, per-project version switching so you can switch between projects without manually switching between Node version. You can also install npm package binaries in your toolchain without having to periodically reinstall them or figure out why they've stopped working.
On most Unix systems, you can install Volta with a single command:
curl https://get.volta.sh | bash
That command not only installs Volta, it also will append your path in your zsh so you can run volta install node
right away.
Volta will also install your favorite package binaries as command-line tools without worrying about them interfering with your local development projects.
volta install netlify-cli
Even better, these tools get pinned to a particular Node engine at installation time and don't change unless you explicitly tell them to. This means that once a tool works, it keeps working.
While contemplating the state dev tools in 2022, I got by using virtual environment tooling from Repl.it for quick sample projects and GitHub Codespaces for existing project work. I was surprised to see how long I could survive without installing anything and look forward to continuing to use those environments in future situations. I will provide more details in a post soon.
I am now curious, What are the first things you install on your new work computer?
Top comments (23)
I'm surprised no one mentioned Homebrew yet :)
brew.sh
Volta is great, I use it on my work windows machine, but for Mac and Linux my preferred is n by tj
github.com/tj/n
Wow wasn’t aware of n.
VSCode would be my 3rd dev tool 🤣
I've used n and nvm, currently back on n, but definitely going to check out Volta!
Interesting, I did not know Volta. Every day I learn something new! Thanks for sharing.
Before I used nvm for Node, rbenv for Ruby, pyenv for Python, etc. I replaced all with asdf asdf-vm.com/. It is clean, consistent and multiplatform.
The first 2 dev tools I installed on my MacBook Pro are: oh-my-zsh and vscode and then I went on with go, iterm2, brew, nvim, and podman. I actually should write and article about what I did in my first day back using a Mac
The per-project switching sounds great. Is it based on the engines field of package.json or some other configurations ?
It is the engines field. docs.volta.sh/guide/understanding#...
That doesn't seem to be the engines field though.
yeah, you are correct on that. Seems like Volta explains that here. github.com/volta-cli/volta/issues/...
Actually I would prefer avoid Volta since it would introduce a private field in package.json which is not used and understandable by the rest of the world.
Weird flex, but ok.
Just imagine a better node version manager in the future. That new node version manager will have to support the Volta field even if it is not Volta.
Yet another weirdness like what we have been facing with :-).
Use asdf or brace yourselves for an nvm/volta/n for every single lang you deal with (nightmare)
will never use nor recommend a lang-specific version manager ever again
Introducing, asdf, one version management tool to rule them all.
Welcome to the future.