Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My 2022 New Mac Setup #420

Closed
swyxio opened this issue May 22, 2022 · 11 comments
Closed

My 2022 New Mac Setup #420

swyxio opened this issue May 22, 2022 · 11 comments

Comments

@swyxio
Copy link
Owner

swyxio commented May 22, 2022


title: My 2022 New Mac Setup
description: I set up a new Mac for work today. Here's everything I use on a Mac for fullstack web development.
tags: mac, tech
published: true
slug: new-mac-setup-2022
category: note
canonical_url: https://www.swyx.io/new-mac-setup-2022/

I set up my new Macbook Pro (16 inch, 2021 M1 Max 32 GB RAM 1TB HD) today. Here's everything I use on a Mac.

Previous versions of this post: from 2018-2020 and another from 2021. If I update this post in future, these contents will be archived but this URL will remain.

Scroll all the way to the bottom for lists and other Mac setup tools from friends!

Immediate first steps

  • Browser: Download Chrome, set to default.
  • Log in to: (this helps with logins for the other services below)
    • Twitter
    • Github (more setup instructions below)
    • Gmail

Things that take a while to install

Get these going first so they can run in the background

  • Install ZSH - sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

  • If M1 mac: /usr/sbin/softwareupdate --install-rosetta --agree-to-license to install Rosetta2

  • Install Homebrew - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" and then

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/swyx/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

i have a bunch more stuff in brew list but i'm not sure what i use actively. You can mass install these - dump them in a packages.txt and then brew install $(cat packages.txt)

bat             gdbm            libuv           python@3.10   pnpm
brotli          gh                  go              ruby
deno          gradle            sqlite        ripgrep
diff-so-fancy   fnm        openjdk         yarn
youtube-dl     ffmpeg     colima      docker
fzf             libev           openssl@1.1     z

Either of these will prompt you to install Apple Command Line Tools - takes 15-25 minutes to download the damn thing so do this first. Don't run them in parallel.

OS/Browser Settings

My full list of extensions I use are here:

aapocclcgogkmnckokdopfmhonfmgoek : Slides : version 0_10
ahfgeienlihckogmohjhadlkjgocpleb : Web Store : version 0_2
amoldiondpmjdnllknhklocndiibkcoe : Twemex: Sidebar for Twitter : version 0_4_4
aohghmighlieiainnegkcijnfilokake : Docs : version 0_10
apdfllckaahabafndbhieahigkjlhalf : Google Drive : version 14_5
bekmjjakgojplnhahcilegeiklenjbgb : Glow : version 1_0
blpcfgokakmgnkcojhhkbfbldkacnbeo : YouTube : version 4_2_8
bmnlcjabgnpnenekpadlanbbkooimhnj : Honey: Automatic Coupons & Cash Back : version 14_11_0
cfldfgibklhmjhnkfighkbafbkbfcmij : Builder : version 1_0_0
cjpalhdlnbpafiamejdnhcphjbkeiagm : uBlock Origin : version 1_42_4
ckolcbmkjpjmangdbmnkpjigpkddpogn : Svelte Devtools : version 1_3_0
dkhfpnphbcckigklfkaemnjdmghhcaoh : netlify-browser-extension : version 1_3_0
fcgckldmmjdbpdejkclmfnnnehhocbfp : Google Finance : version 1_3
felcaaldnbdncclmgdcncolpebgiejap : Sheets : version 1_2
fmkadmapgofadopljbjfkapdkoienihi : React Developer Tools : version 4_24_6
fpnmgdkabkmnadcjpehmlllkndpkmiak : Wayback Machine : version 3_1
geancnifhbkbjijfkcjjdnfemppmcjmk : Hacker News : version 3_21_0
gfdkimpbcpahaombhbimeihdjnejgicl : Feedback : version 1_0
ghbmnnjooekpmoecnnnilnnbdlolhkhi : Google Docs Offline : version 1_42_0
gieabiemggnpnminflinemaickipbebg : CSS Scan : version 3_8_1
hbdpomandigafcibbmofojjchbcdagbl : TweetDeck by Twitter : version 3_10
hdokiejnpimakedhajhdlcegeplioahd : LastPass: Free Password Manager : version 4_95_0_3
hjgngigpjehgifcepdhlnnikibmgeflc : Upnext - Save it for later! : version 4_2_0
hlepfoohegkhhmjieoechaddaejaokhf : Refined GitHub : version 22_5_22
kljjoeapehcmaphfcjkmbhkinoaopdnd : HyperWrite : version 2_0_29
kmendfapggjehodndflmmgagdbamhnfd : CryptoTokenExtension : version 0_9_74
liecbddmkiiihnedobmlmillhodjkdmb : Loom – Free Screen Recorder & Screen Capture : version 5_3_2
mhjfbmdgcfjbbpaeojofohoefgiehjai : Chrome PDF Viewer : version 1
mjdepdfccjgcndkmemponafgioodelna : DF Tube (Distraction Free for YouTube™) : version 1_13_504
neajdppkdcdipfabeoofebfddakdcjhd : Google Network Speech : version 1_0
nffaoalbilbmmfgbnbgppjihopabppdk : Video Speed Controller : version 0_7_1
nkeimhogjdpnpccoofpliimaahmaaome : Google Hangouts : version 1_3_18
nmmhkkegccagdldgiimedpiccmgmieda : Chrome Web Store Payments : version 1_0_0_6
oiaejidbmkiecgbjeifoejpgmdaleoha : Stylebot : version 3_1
pachckjkecffpdphbpmfolblodfkgbhl : vidIQ Vision for YouTube : version 3_73_2
pbgbbbfhjccnnkplhfcmhdcpmcfmpfoi : toast.log : version 2_3
pjkljhegncpnkpknbcohdijeoejaedia : Gmail : version 8_3
poahndpaaanbpbeafbkploiobpiiieko : Display #Anchors : version 1_4

Setup Terminal

  • Copy my dotfiles (vimrc, zshrc, .gitignore_global): https://gist.github.com/sw-yx/7fa1009e460ecb818d5e6d9ca4616a05
  • Install ZSH (first usage of git will prompt you to install git - takes 15 minutes)
    • git config --global init.defaultBranch main
    • git config --global user.name "swyx"
    • git config --global user.email shawnthe1@gmail.com
    • once you have installed diff-so-fancy
      • set git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX" - makes for much nicer git diff
      • You can also diff with this bash function dif() { git diff --color --no-index "$1" "$2" | diff-so-fancy; } or with VSCode code --diff file1.js file2.js.
      • You can also try https://github.com/dandavison/delta
  • Download, install, and set font - Inconsolata for Powerline
  • customize the /oh-my-zsh/themes/agnoster theme from dotfiles
  • For my terminal, I used to use Hyper, but this year I am trying out Warp: https://warp.dev/
    • only settings I really need to make are setting the font to "Inconsolata for Powerline" - which I downloaded above.

See previous year for my Hyper terminal recommendations.

Set up apps/environments

You should have already installed a bunch of stuff with Homebrew as per above. Below I will list other stuff that you may wish to use:

  • Github CLI: brew install github/gh/gh
    • you need to login to git - if you have 2fa enabled, you cant use your normal github password. try pushing to any random repo and enter in a Personal Access Token for password.
    • then run gh auth login
    • add GitHub SSH key (not optional)
  • Setup Node.js/NPM and login to npm: - you should already have fnm (a faster alternative to nvm) from the Homebrew install done above so no separate download needed.
    • apaprently running arch -x86_64 zsh lets you avoid weird dotenv errors but it didnt work for me (just running npm i on swyxkit)
    • then fnm install 16
    • npm login
    • npm config set loglevel="warn"
    • sudo npm install netlify-cli -g then netlify login
    • npm i -g sign-bunny fortune-node parrotsay fun little cli utilities to use
    • npm i -g undollar for removing $
    • npm install -g npm-check-updates for updating deps
    • sudo npm install -g trash-cli to add a trash command to so you dont permanently delete files
  • brew install yarn --ignore-dependencies - yarn note
  • you may need to work around Mac OS Sierra
  • brew install z - doesnt work out of the box exactly - see my issue on the rupa/z repo - homebrew changed the default install path of the z.sh script so just make sure you are pointing to the right new path - /opt/homebrew/etc/profile.d/z.sh
  • Misc - stuff i used to install and maybe dont need anymore

Notes on other stuff we already brew installed

- `brew install java` - you could download [Java Development Kit](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) from Oracle but fuck them for putting it behind signup wall
- `brew install go` you may need to `export PATH=$PATH:/usr/local/go/bin`

Setup Apps


Other good "new laptop setup" lists:

@rahuldotbiz
Copy link

Just loved the posts. I don't own mac, but in future YES. Saving this article.

@rbourbotte
Copy link

rbourbotte commented May 25, 2022

Hi, nice setup and nice tools !

Do you have some automation tools to rebuild easily and quickly like ansible or a bash script ?

@swyxio
Copy link
Owner Author

swyxio commented May 26, 2022

hey @rbourbotte no i dont - since i only do this when i get a new mac (which isnt that often) i want to be able to go through each tech choice every time and re evaluate if i want a new thing

@hungdoansy
Copy link

Very useful article. Found NoTunes which I needed for years

@swyxio swyxio closed this as completed May 28, 2022
@sheldonhull
Copy link

I've messed around with zsh for a while now and I've arrived at two things: chezmoi for syncing my dotfiles and install scripts, and zinit for my profile. It's confusing, but worth it.

For example, just use (if you have zinit and it's annex stuff initialized).

zinit ice as"null" lucid from"github-rel" \
    mv"zoxide* -> zoxide"  \
    extract'' \
    lucid  \
    sbin'zoxide'
zinit load ajeetdsouza/zoxide
if command -v zoxide &>/dev/null; then
    eval "$(zoxide init zsh)"  &>/dev/null || warn
    # zinit snippet https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/zoxide.plugin.zsh || warn
fi

Zoxide now replaces "z" and is a rust based quick change folder alternative.

Then I have others like:

# install "better" ls
zinit ice wait"2" lucid from"gh-r" as"program" mv"exa* -> exa" extract'' ogham/exa
zinit wait lucid light-mode for atpull'zinit creinstall -q completions/zsh/_exa' ogham/exa

# super great inline history search, ctrl+r on steroids.
zstyle ":history-search-multi-word" page-size "11"
zinit ice wait"1" lucid
zinit load zdharma-continuum/history-search-multi-word

zinit snippet OMZP::gh
zinit snippet OMZP::golang
zinit snippet OMZP::helm
# ... etc

This downloads the correct binary for your system, and shims it automatically.

Note the benefit of doing this with chezmoi is my dotfiles are now a single command to sync on windows (wsl2), docker devcontainers, codespaces, and my mac. It works everywhere and I just run chezmoi update to get whatever latest is my repo. Because it's simple Go templating, you can just add or remove a block for any OS in the same file. Also you can set run_once_install_script.sh or run_always_install_script.sh so basic installs can be added, like my global asdf file.

The fact it can match and install the right github release automatically feels magical to be honest.
If you want to give it a try, I could clean-up a simple starter repo for you to experiment with. Definitely recommend if you want to keep settings/aliases/plugins easy to sync to any machine.

@swyxio
Copy link
Owner Author

swyxio commented Jun 6, 2022

this looks cool! unfortunately i dont setup dotfiles that often that i feel like i need it right now but i'll def refer to this when I need to sync.

@swyxio
Copy link
Owner Author

swyxio commented Jun 17, 2022

Jun 2022: https://shottr.cc/ just launched on HN and I am trying it out.

@sheldonhull
Copy link

Fig just released a dotfiles tool for Early Access as well.

@unkrich
Copy link

unkrich commented Jun 26, 2022

Adding my own implementation as well as a resource if it's useful: https://github.com/unkrich/base-osx

@swyxio
Copy link
Owner Author

swyxio commented Sep 16, 2022

@kishvanchee
Copy link

I use Flameshot on linux and mac. It's been great. Hope you like it. https://flameshot.org/docs/installation/installation-osx/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants