[{"content":"Welcome to my blog! This is the first post built with Hugo and the Stack theme.\nAbout This Blog This blog is powered by:\nHugo — A fast static site generator Stack Theme — A card-style Hugo theme designed for bloggers GitHub Pages — Free static site hosting Looking forward to sharing more here.\n","date":"2026-04-22T00:00:00Z","image":"/p/hello-world/cover.svg","permalink":"/en/p/hello-world/","title":"Hello, World"},{"content":"This post walks through setting up a development environment on macOS arm64 (Apple Silicon), installing Homebrew under the user\u0026rsquo;s home directory, and using rbenv, pyenv, and nvm to manage Ruby, Python, and Node.js versions.\nWhy Install to the User Directory By default, Homebrew installs to /opt/homebrew (Apple Silicon) or /usr/local (Intel), both requiring admin privileges. Installing to a user directory like ~/.homebrew offers:\nNo sudo required — everything stays in user space No interference with system-level package management Clean isolation in multi-user environments Easy to migrate or remove entirely 1. Installing Homebrew 1.1 Clone Homebrew to User Directory 1 git clone https://github.com/Homebrew/brew.git ~/.homebrew 1.2 Configure Environment Variables Add to ~/.zshrc (or ~/.bash_profile for bash):\n1 2 3 4 5 6 7 # Homebrew export HOMEBREW_PREFIX=\u0026#34;$HOME/.homebrew\u0026#34; export PATH=\u0026#34;$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:$PATH\u0026#34; export HOMEBREW_CELLAR=\u0026#34;$HOMEBREW_PREFIX/Cellar\u0026#34; export HOMEBREW_REPOSITORY=\u0026#34;$HOMEBREW_PREFIX\u0026#34; export MANPATH=\u0026#34;$HOMEBREW_PREFIX/share/man:$MANPATH\u0026#34; export INFOPATH=\u0026#34;$HOMEBREW_PREFIX/share/info:$INFOPATH\u0026#34; Variable Purpose HOMEBREW_PREFIX Homebrew installation root PATH Prioritize Homebrew binaries over system ones HOMEBREW_CELLAR Where installed packages are stored HOMEBREW_REPOSITORY Location of the Homebrew core repo MANPATH / INFOPATH Documentation search paths Apply changes:\n1 source ~/.zshrc 1.3 Verify 1 2 brew --version brew doctor 2. Ruby with rbenv 2.1 Install rbenv and ruby-build 1 brew install rbenv ruby-build 2.2 Configure rbenv Add to ~/.zshrc:\n1 2 # rbenv eval \u0026#34;$(rbenv init - zsh)\u0026#34; rbenv init prepends ~/.rbenv/shims to PATH, installs shell functions for rehashing, and enables autocompletion.\n1 source ~/.zshrc 2.3 Install Ruby 1 2 3 4 rbenv install -l # list available versions rbenv install 3.3.7 # install a specific version rbenv global 3.3.7 # set as default ruby --version # verify Use rbenv local 3.x.x in a project directory to pin a version via .ruby-version.\n3. Python with pyenv 3.1 Install pyenv 1 brew install pyenv 3.2 Configure pyenv Add to ~/.zshrc:\n1 2 3 4 # pyenv export PYENV_ROOT=\u0026#34;$HOME/.pyenv\u0026#34; [[ -d $PYENV_ROOT/bin ]] \u0026amp;\u0026amp; export PATH=\u0026#34;$PYENV_ROOT/bin:$PATH\u0026#34; eval \u0026#34;$(pyenv init - zsh)\u0026#34; Config Purpose PYENV_ROOT Root directory where all Python versions are stored PATH append Ensures the pyenv binary is found pyenv init Adds shims to PATH for version switching 3.3 Install Build Dependencies 1 brew install openssl readline sqlite3 xz zlib tcl-tk 3.4 Install Python 1 2 3 4 pyenv install -l | grep -E \u0026#34;^\\s+3\\.\u0026#34; # list Python 3.x versions pyenv install 3.13.3 pyenv global 3.13.3 python --version 4. Node.js with nvm Unlike rbenv/pyenv, nvm is not installed via Homebrew (officially discouraged). Use the install script instead.\n4.1 Install nvm 1 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash 4.2 Verify Configuration The script should have added this to ~/.zshrc:\n1 2 3 4 # nvm export NVM_DIR=\u0026#34;$HOME/.nvm\u0026#34; [ -s \u0026#34;$NVM_DIR/nvm.sh\u0026#34; ] \u0026amp;\u0026amp; \\. \u0026#34;$NVM_DIR/nvm.sh\u0026#34; [ -s \u0026#34;$NVM_DIR/bash_completion\u0026#34; ] \u0026amp;\u0026amp; \\. \u0026#34;$NVM_DIR/bash_completion\u0026#34; nvm is a pure shell function, not a binary — it\u0026rsquo;s loaded into each shell session via nvm.sh.\n4.3 Install Node.js 1 2 3 4 5 nvm ls-remote --lts # list LTS versions nvm install --lts # install latest LTS nvm alias default 22 # set default version node --version npm --version 5. Complete ~/.zshrc Summary 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # Homebrew (user directory) export HOMEBREW_PREFIX=\u0026#34;$HOME/.homebrew\u0026#34; export PATH=\u0026#34;$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:$PATH\u0026#34; export HOMEBREW_CELLAR=\u0026#34;$HOMEBREW_PREFIX/Cellar\u0026#34; export HOMEBREW_REPOSITORY=\u0026#34;$HOMEBREW_PREFIX\u0026#34; export MANPATH=\u0026#34;$HOMEBREW_PREFIX/share/man:$MANPATH\u0026#34; export INFOPATH=\u0026#34;$HOMEBREW_PREFIX/share/info:$INFOPATH\u0026#34; # rbenv eval \u0026#34;$(rbenv init - zsh)\u0026#34; # pyenv export PYENV_ROOT=\u0026#34;$HOME/.pyenv\u0026#34; [[ -d $PYENV_ROOT/bin ]] \u0026amp;\u0026amp; export PATH=\u0026#34;$PYENV_ROOT/bin:$PATH\u0026#34; eval \u0026#34;$(pyenv init - zsh)\u0026#34; # nvm export NVM_DIR=\u0026#34;$HOME/.nvm\u0026#34; [ -s \u0026#34;$NVM_DIR/nvm.sh\u0026#34; ] \u0026amp;\u0026amp; \\. \u0026#34;$NVM_DIR/nvm.sh\u0026#34; [ -s \u0026#34;$NVM_DIR/bash_completion\u0026#34; ] \u0026amp;\u0026amp; \\. \u0026#34;$NVM_DIR/bash_completion\u0026#34; 6. Notes Architecture: Some older Ruby/Python/Node.js versions lack arm64 prebuilt binaries and will compile from source (slower). Ensure Xcode Command Line Tools are installed: xcode-select --install.\nUser-directory Homebrew: Not all bottles (prebuilt packages) are available for non-standard paths. Homebrew will fall back to source compilation when needed. Run brew doctor to check for issues.\nVersion pinning: Use local commands (rbenv local, pyenv local) and commit .ruby-version, .python-version, .nvmrc to version control for team consistency.\nNo sudo: Never use sudo with gem install, pip install, or npm install -g — the version managers already point these to user-space directories.\nLoad order in ~/.zshrc: Homebrew PATH first (rbenv/pyenv depend on it), then rbenv/pyenv init (they prepend shims), then nvm (independent).\nTroubleshooting:\n1 2 3 4 5 6 7 which ruby \u0026amp;\u0026amp; ruby --version which python \u0026amp;\u0026amp; python --version which node \u0026amp;\u0026amp; node --version rbenv versions pyenv versions nvm ls echo $PATH | tr \u0026#39;:\u0026#39; \u0026#39;\\n\u0026#39; ","date":"2026-04-22T00:00:00Z","image":"/p/macos-dev-env-setup/cover.svg","permalink":"/en/p/macos-dev-env-setup/","title":"macOS ARM64 Dev Environment Setup: Homebrew, Ruby, Python, Node.js"}]