Lesson 13 of 18Your tools
Setting Up Your Machine
Set up a package manager, editor, version-managed Python and Node, Git, SSH and your shell the way professionals do, on macOS, Linux or WSL.
The code windows on RazorCode run in your browser, but real projects run on your computer. A clean setup saves you hours of "works on my machine" confusion later, and it is the first thing you do on day one of any developer job. This lesson walks through the setup most professional Python and JavaScript developers use in 2026. Take your time: installing tools is fiddly for everyone, and you only do it once.
Commands below are for macOS and Linux. On Windows, install WSL first (see the terminal lesson) and follow the Linux steps inside it.
The toolchain at a glance
The foundation: a shell to run commands and Git to save your work.
A system package manager first
Before any language tools, install a system package manager: one command-line tool that installs and updates everything else (Git, curl, jq, databases, even apps). Downloading installers from websites one by one leaves you with a machine nobody can reproduce or update.
| System | Package manager | Example |
|---|---|---|
| macOS | Homebrew | brew install git jq |
| Ubuntu, Debian, WSL | apt | sudo apt install git jq |
| Fedora | dnf | sudo dnf install git jq |
| Windows (outside WSL) | winget (built in) | winget install --id Git.Git -e |
On a Mac, install Homebrew with the one-line command on brew.sh, then do the step people miss: the installer prints two lines to add Homebrew to your PATH, and until you run them, brew is "command not found".
eval "$(/opt/homebrew/bin/brew shellenv)" # this terminalecho 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile # every future terminalbrew install git jq tldrbrew upgrade # update everything laterWhere things go differs by machine. On Apple Silicon Macs Homebrew lives in /opt/homebrew; on older Intel Macs it is /usr/local, so old tutorials that hard-code /usr/local/bin are wrong on new Macs. On Linux, apt installs into /usr/bin and needs sudo, while Homebrew on a Mac never does. If you find yourself typing sudo brew or sudo pip install, stop: that is a sign something is set up wrong. On Ubuntu, run sudo apt update before installing, so apt knows about current versions.
An editor: VS Code
Visual Studio Code (VS Code) is free, runs everywhere, and is what most tutorials assume. Good alternatives exist (Cursor and Zed are popular editors; PyCharm and WebStorm are full IDEs), and everything here transfers to them.
After installing it, open the Command Palette (Cmd+Shift+P on Mac, Ctrl+Shift+P elsewhere), run Shell Command: Install 'code' command in PATH, and you can open any folder from the terminal with code ..
Extensions add language support. The essentials, in general terms:
- Python support (Microsoft's Python extension, with Pylance for autocomplete and type checking).
- Ruff, the Python linter and formatter.
- ESLint and Prettier for JavaScript and TypeScript.
- Optionally an extension for Git history and one for your CSS framework.
Then turn on format on save, so your code is tidied every time you press save. In VS Code's settings.json:
{
"editor.formatOnSave": true,
"[python]": { "editor.defaultFormatter": "charliermarsh.ruff" },
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
}Installing Python
Your Mac may already have a python3, but it is often old and belongs to the system. You want your own, current version that you control. There are three common routes:
| Route | Good for |
|---|---|
| uv (from Astral) | The modern all-in-one choice: installs Python versions, creates virtual environments, manages packages. Very fast. |
| python.org installer | The simplest one-off install. Fine to start with. |
| pyenv | The long-standing tool for juggling many Python versions. |
We recommend uv. Install it, then let it install Python:
curl -LsSf https://astral.sh/uv/install.sh | sh # install uvuv python install 3.14 # install Python 3.14uv --versionuv also creates projects. Each project gets its own virtual environment (a private folder of packages, .venv), so two projects can use different versions of the same library without clashing. The Python course covers virtual environments in depth.
uv init notes-app # create a project with pyproject.toml and main.pycd notes-appuv add httpx # install a package and record it in pyproject.tomluv run main.py # run inside the project's environmentWhy not the system Python?
macOS and Linux both ship a python3, and it is tempting to use it. Do not build on it. That Python belongs to the operating system: on Linux, system tools are written in it, and its version is whatever the distribution chose. Install packages into it with sudo pip and you can break the OS's own tools. Modern Linux distributions and Homebrew now refuse with an externally-managed-environment error for exactly this reason. That error is not a problem to work around; it is telling you to use a virtual environment.
The professional setup is one version manager per language, or one for all of them, so each project gets the exact version it declares:
| Tool | Manages | Project version file |
|---|---|---|
| uv | Python versions, environments and packages | .python-version, pyproject.toml |
| fnm or nvm | Node.js versions | .nvmrc or .node-version |
| mise | Node, Python, Go, Java and more in one tool | mise.toml (also reads .nvmrc and .python-version) |
uv python install 3.13 3.14 # several versions side by sideuv python pin 3.13 # this project uses 3.13: writes .python-versionuv run python --version # Python 3.13.x, chosen from the pinCommit the version file. A new teammate clones the repo, and the tools pick the same version automatically, which removes a whole class of "works on my machine" bugs. When versions still look wrong, The Terminal's "Which program actually runs?" shows how to find out which binary you are getting. mise is worth a look if your team uses several languages: it installs runtimes and, like the others, switches them per folder. Check its official docs for the current install command.
pip install requests on Ubuntu fails with error: externally-managed-environment. What should you do?Installing Node.js
Node.js lets you run JavaScript outside the browser, and it comes with npm, its package manager. Install it through a version manager so you can switch versions per project. fnm (fast node manager) is quick and simple; nvm is the older, very common choice. Always pick the LTS (long-term support) version unless a project says otherwise.
curl -fsSL https://fnm.vercel.app/install | bash # or: brew install fnmfnm install --lts # install the current LTS Nodenode --versionnpm --versionWith nvm the commands are nvm install --lts and nvm use --lts. A project can pin its Node version in a .nvmrc or .node-version file, which both tools read.
Many teams use pnpm instead of npm because it is faster and uses less disk space. The commands are nearly the same:
npm install -g pnpmpnpm add zod # same idea as: npm install zodPackage managers in one table
| Python | JavaScript | |
|---|---|---|
| Package registry | PyPI | npm registry |
| Tool | uv (or pip) | npm (or pnpm) |
| Add a package | uv add httpx | npm install zod |
| Project file | pyproject.toml | package.json |
| Lockfile (exact versions) | uv.lock | package-lock.json / pnpm-lock.yaml |
| Installed into | .venv/ | node_modules/ |
The lockfile records the exact version of every package, so your teammate and your server install exactly what you tested with. Commit the lockfile. Never commit .venv/ or node_modules/: anyone can recreate them from the lockfile with uv sync or npm install.
Match each tool to its job.
Git and SSH: the day-one checklist
A new laptop at a new job usually means the same short list. Each item links to the lesson that explains it:
- Install Git through your package manager (
brew install git,sudo apt install git, orwingeton Windows). The Git that comes with Apple's developer tools works but lags behind. - Set your identity and defaults:
user.name,user.email(your work email on a work machine),init.defaultBranch mainand an editor. Git Basics covers these. - Create an SSH key with
ssh-keygen -t ed25519, protect it with a passphrase, and add the public half to GitHub. SSH and Remote Machines walks through it, including~/.ssh/config. - Check it works:
ssh -T git@github.comshould greet you by username. - Clone over SSH (
git@github.com:org/repo.git), not HTTPS, unless your company says otherwise. - Turn on two-factor authentication on GitHub, preferably with a passkey or an authenticator app. Security Basics for Developers explains why.
Many companies also require signed commits and single sign-on for their GitHub organisation. Your onboarding docs will say; the settings that matter are covered in Commits Your Teammates Thank You For.
Dotfiles, startup files and a prompt
Your shell reads startup files when it opens, and knowing which one runs saves a lot of confusion when a PATH change "does not work":
| Shell | Read by login shells | Read by every interactive shell |
|---|---|---|
| zsh (macOS default) | ~/.zprofile | ~/.zshrc |
| bash (most Linux, WSL) | ~/.bash_profile or ~/.profile | ~/.bashrc |
On macOS every new Terminal window is a login shell, so both zsh files run. Installers edit these files for you. Here is what the python.org installer added to one real ~/.zprofile:
# Setting PATH for Python 3.14# The original version is saved in .zprofile.pysavePATH="/Library/Frameworks/Python.framework/Versions/3.14/bin:${PATH}"export PATHIt prepends its folder, so its Python wins the PATH search from then on. Open these files once in a while and read what has piled up; old installers leave lines that point at tools you removed, and a duplicated line can put the wrong version first. Changes apply to new terminals, or run source ~/.zshrc to reload the current one.
A good prompt shows the current folder, Git branch and whether there are uncommitted changes, so you never commit to the wrong branch. Starship is a popular, fast prompt that works in zsh, bash and PowerShell alike: install it with your package manager and add its one init line to your startup file, as its docs show. Oh My Zsh is the older, heavier alternative.
Aliases, functions and keeping these files in a dotfiles repo are covered in Shell Power Tools, and Shell Scripting shows a bootstrap.sh that sets a new machine up in one command.
A tidy home for your code
Keep every project in one folder, such as ~/code, with one subfolder per project. Never put code on your Desktop or in a cloud-synced folder like iCloud Drive or Dropbox: syncing thousands of small files in node_modules or .venv is slow and can corrupt them.
- code/
- notes-app/a Python project
- .git/Git's history (hidden)
- .venv/virtual environment, not committed
- .envyour secrets, not committed
- .env.examplethe same keys with fake values, committed
- .gitignore
- pyproject.tomlproject settings and dependencies
- uv.lockexact versions, committed
- main.py
- portfolio/a JavaScript project
- .git/
- node_modules/installed packages, not committed
- .gitignore
- package.json
- package-lock.json
- index.js
- playground/scratch files for experiments
Set up and run a new Python project from scratch.
- Tap the steps below in the right order.
WSL2: what is different
If you are on Windows, WSL2 runs a real Linux kernel in a lightweight virtual machine. Almost everything works as on Linux, with a few rules that matter for speed and sanity:
- Keep code in the Linux file system, under
~/codeinside WSL, not under/mnt/c/Users/.... Windows drives are reachable from Linux, but every file access crosses between the two systems.npm install,git statusand test runs on/mnt/ccan be many times slower, and file watchers for hot reload may not notice changes at all. - Open projects from inside WSL:
cd ~/code/notes-app && code .opens VS Code on Windows connected to WSL (with Microsoft's WSL extension), so the editor, terminal and tools all run on the Linux side. - Reach Linux files from Windows through
\\wsl$in File Explorer, or runexplorer.exe .from a WSL folder. - Install tools twice when needed. Git, Node and Python inside WSL are separate from any you installed on Windows. Use the Linux ones for WSL projects, and keep line endings as LF (see Git Basics).
- Ports are shared. A dev server on
localhost:3000inside WSL opens in your Windows browser at the same address. - Keep WSL updated with
wsl --updatefrom PowerShell, and if builds run out of memory, the limit can be raised in a.wslconfigfile in your Windows user folder (check Microsoft's WSL docs for the current options).
Match each WSL symptom to its cause or fix.
Running your code
Inside a project folder, running a file is one command:
python3 main.py # or: uv run main.pynode index.jsA program is just a file of instructions. The runtime (Python or Node.js) reads it from top to bottom, exactly like the code windows on this site.
Environment variables and .env files
Your code will need settings that differ between your laptop and the server, and secrets that must never be in the code: database passwords, API keys. The standard place for both is environment variables (named values the operating system passes to every program, from the terminal lesson).
Press Run (⌘ Enter) to see what happens.Typing export every time is tedious, so projects keep local values in a .env file:
DATABASE_URL=postgres://localhost:5432/notesWEATHER_API_KEY=not-a-real-keyDEBUG=trueNode.js reads it with node --env-file=.env index.js and exposes values on process.env. In Python the python-dotenv package's load_dotenv() loads it into os.environ.
Read a .env file
Tools like python-dotenv and Node's --env-file read a .env file into environment variables. Write the core of that: turn the file's text into a dictionary/object.
# database settings
DATABASE_URL=postgres://localhost/app
DEBUG = true
GREETING="hello world"becomes
{"DATABASE_URL": "postgres://localhost/app", "DEBUG": "true", "GREETING": "hello world"}Rules:
- Lines are separated by
\n. Trim spaces from each line. - Skip blank lines, lines starting with
#, and lines without an=. - Split at the first
=. Trim spaces around the key and the value. - If the value is wrapped in matching double quotes or single quotes, remove them (keep what is inside, spaces included).
- If a key repeats, the last one wins.
Formatters and linters
A formatter rewrites your code's layout (spacing, quotes, line breaks) to one consistent style. Nobody argues about style in code review because the tool decides. A linter reads your code and warns about things that are probably bugs: unused variables, unreachable code, a variable used before it is defined.
Here is a bug a linter catches instantly. Run it: the list is empty, yet it says it has items.
Press Run (⌘ Enter) to see what happens.The = assigns 0 instead of comparing with ===. The result of that assignment is 0, which counts as false, so the else branch runs. ESLint's no-cond-assign rule flags this line before you ever run it.
What does this print?
let count = 5;
if (count = 0) {
console.log("none");
}
console.log(count);Setting them up takes a minute:
# Python, inside a uv projectuv add --dev ruffuv run ruff check . # lintuv run ruff format . # format# JavaScript, inside an npm projectnpm install --save-dev prettier eslintnpx prettier --write . # formatnpx eslint . # lintTeams also run these in CI (continuous integration: automatic checks on every pull request), so badly formatted or obviously buggy code cannot be merged.
- version manager
- A tool (uv, fnm, nvm, pyenv) that installs language runtimes and switches between versions.
- package manager
- A tool (uv, pip, npm, pnpm) that downloads libraries and records which versions a project uses.
- lockfile
- A file recording the exact version of every installed package, so every machine installs the same thing. Commit it.
- virtual environment
- A per-project folder of Python packages (
.venv), so projects do not interfere with each other. - .env file
- A local, gitignored file of environment variables, used for settings and secrets during development.
- linter vs formatter
- A formatter fixes layout automatically. A linter warns about likely bugs.
- system package manager
- A tool (Homebrew, apt, winget) that installs and updates command-line tools and apps for the whole machine.
- dotfiles
- Hidden config files like
~/.zshrcand~/.gitconfig, often kept in a Git repo to set up new machines fast. - WSL2
- Windows Subsystem for Linux: a real Linux kernel in a light VM. Keep code in its own file system for speed.