A Mac developer setup that lasts needs one version manager per language, not one global install of each. For most people that means uv for Python, fnm for Node.js, Eclipse Temurin with java_home for Java, and a versioned Homebrew formula for PostgreSQL. Each one keeps several versions side by side and stays clear of the Python that macOS and Homebrew depend on.
This guide installs all four on Apple Silicon, switches versions per project, and ends with a ~/.zshrc block and a checklist. We checked every command in November 2026 on an Apple M4 Mac (an AWS mac-m4.metal host) running macOS 27.2.1, with uv 0.13.9, fnm 1.39.0, Temurin 25.0.5.1 and PostgreSQL 18.7.
What does this Mac developer setup install?
It installs one manager per runtime, all through Homebrew, so a single brew upgrade keeps the managers current while each project keeps the runtime version it was built on. If Homebrew is not on the Mac yet, install Homebrew on macOS first, because every command below starts with brew. Homebrew also pulls in the Xcode Command Line Tools, so git and a C compiler come along with it.
| Runtime | Tool we use | Where it lives | How a project pins it |
|---|---|---|---|
| Python | uv (brew install uv) | ~/.local/share/uv/python | .python-version and uv.lock |
| Node.js | fnm (brew install fnm) | ~/.local/share/fnm | .node-version or .nvmrc |
| Java | Temurin casks | /Library/Java/JavaVirtualMachines | JAVA_HOME from java_home -v |
| PostgreSQL | postgresql@18 formula | /opt/homebrew/var/postgresql@18 | The versioned formula name |
Python, Node and PostgreSQL install into your home directory or the Homebrew prefix, so none of them asks for sudo. Java is the exception, because macOS keeps system JDKs under /Library/Java and Homebrew has to run the Temurin installer as root to put them there. PostgreSQL needs sudo in one case too, and the database section explains when. Check these before you start:
brew --versionprints a version instead of “command not found”.xcode-select -pprints a path to the Command Line Tools.echo $SHELLprints/bin/zsh, the macOS default shell this guide configures.- Your account can run
sudo, which the Java installs need.
If you use bash instead of zsh, write --shell bash wherever this guide runs fnm env, and put the shell block from the end into ~/.bashrc. Everything else stays the same.
Which python3 does your Mac already have?
Often two of them, and you should not build projects on either. Apple ships a /usr/bin/python3 stub tied to the Command Line Tools, and Homebrew installs its own python3 the moment any formula depends on it. Check what your PATH resolves before adding a third.
which -a python3
python3 --version
/usr/bin/python3 --version
On our test Mac the Homebrew copy came first in PATH, and it was a newer Python than most projects target, pulled in as a dependency of the AWS CLI. Apple’s copy was much older. The duplicate path line comes from a shell profile that adds the Homebrew directory twice, which is common and harmless.
/opt/homebrew/bin/python3
/usr/bin/python3
/opt/homebrew/bin/python3
Python 3.15.2
Python 3.9.6
The Homebrew interpreter, the one first in PATH, no longer takes packages. Homebrew marks its Python as externally managed under PEP 668, so a plain pip3 install stops with an error instead of writing into the Homebrew prefix. We tried it with requests.
pip3 install requests
The first lines of the refusal name the problem and point to a virtual environment as the way out. Homebrew’s text also suggests pipx for applications.
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
If you wish to install a Python library that isn't in Homebrew,
use a virtual environment:
Do not reach for --break-system-packages. A brew upgrade that bumps the Python formula would strand whatever you installed, and a broken Homebrew Python can take tools like the AWS CLI down with it. Homebrew warns about exactly that in the same message. Apple’s copy still has an old pip of its own, but it is tied to the Command Line Tools and changes when they update. So leave both interpreters alone and let a version manager own the Pythons your projects use.
How do you install Python on a Mac with uv?
Install uv from Homebrew, then let uv download the Python you want. uv replaces pyenv, pip, venv and pipx with one binary, and its standalone Python builds do not touch the Homebrew or Apple copies. We pick it over pyenv on a Mac because it downloads a prebuilt interpreter instead of compiling one, so a new Python takes seconds rather than minutes.
brew install uv
uv python install 3.14
uv python list --only-installed
uv reported the install step at under a second on the M4, and the list afterwards shows all three interpreters with the new one under ~/.local/share/uv. Read the warning at the end of the install as well. uv puts its executables in ~/.local/bin, which is not on a stock macOS PATH, so the shell section later adds it.

With the interpreter in place, a project is one command. uv init writes the pyproject.toml and a .python-version file, and uv add creates the virtual environment on first use, so there is no separate venv step to forget.
uv init --python 3.14 hello-api
cd hello-api
uv add requests
uv run python -c "import sys, requests; print(sys.version.split()[0], requests.__version__)"
uv tool install ruff
The last command printed 3.14.10 2.34.2, which shows the project runs on the uv Python and not the Homebrew one. Because .python-version holds just 3.14 and uv.lock pins every package, a teammate who clones the repo and runs uv sync gets the same interpreter line and the same dependency tree. In the capture below, check these:
uv addreports “Using CPython 3.14.10” and creates.venvinside the project.ls -ashows.python-version,.venv,pyproject.tomlanduv.lock.uv tool install ruffputs aruffexecutable in~/.local/bin.

Command line tools such as ruff, black or httpie belong in uv tool install rather than inside a project, because each tool then gets its own isolated environment. That is the job pipx used to do, and it means upgrading ruff can never break a project’s dependencies.
Next, make a bare python3 in new terminals mean the uv Python, because the shell block and the checklist at the end rely on it. uv installs python and python3 executables for that with --default. The flag still prints an experimental warning, as uv’s Python versions docs also say, so check the docs again after a major uv upgrade.
uv python install 3.14 --default
ls ~/.local/bin
Between the two warnings, uv adds two executables named python and python3 next to the versioned binary and ruff. Nothing else in the directory changes.
warning: The `--default` option is experimental and may change without warning. Pass `--preview-features python-install-default` to disable this warning
Installed Python 3.14.10 in 210ms
+ cpython-3.14.10-macos-aarch64-none (python, python3)
warning: `/Users/ec2-user/.local/bin` is not on your PATH. To use installed Python executables, run `export PATH="/Users/ec2-user/.local/bin:$PATH"` or `uv python update-shell`.
python
python3
python3.14
ruff
The same uv workflow runs unchanged on Linux, which our guide to Python on Ubuntu 26.04 with pip, venv, pyenv and uv walks through. Keep the uv cheat sheet open for the commands you will use daily.
How do you install Node.js on a Mac?
Install fnm with Homebrew and let it fetch Node versions, rather than running brew install node. The Homebrew formula follows the newest release, so one brew upgrade can move every project to a new major at once. fnm is a Rust rewrite of nvm that starts instantly and reads the same .nvmrc files, which means existing projects need no changes.
brew install fnm
eval "$(fnm env --use-on-cd --shell zsh)"
fnm list-remote --lts | tail -5
fnm install --lts
node -v
npm -v
which node
The eval line activates fnm in the current shell, and without it node is still missing after the install. On our run the LTS list ended at the Node 26 line, so --lts picked that and brought npm 11 with it. Look at the which node line too. A path inside fnm_multishells is the healthy result, because that is how fnm gives each terminal its own active version.

If which node prints /opt/homebrew/bin/node instead, an old brew install node is shadowing fnm, so run brew uninstall node and open a new terminal.
Pin an older Node per project
A project that still targets Node 24 gets a .node-version file, and fnm switches the moment you enter its folder. Step out of hello-api, install the older line once, then write the file in the project root and commit it with the code.
cd ..
fnm install 24
mkdir -p legacy-app
echo 24 > legacy-app/.node-version
Because the shell was set up with --use-on-cd, moving in and out of the folder is enough. We went from the default Node 26 into the project and back without typing fnm use once, and the version followed us both ways.

fnm also reads .nvmrc, so a repo set up for nvm switches the same way without a second file.
Where did corepack go?
Older guides tell you to run corepack enable for pnpm or Yarn. On a current Node that fails with command not found: corepack, because the Node.js docs say Corepack is no longer distributed starting with Node.js v25. Install the package manager with npm instead, once per Node version you use.
npm install -g pnpm
pnpm -v
npm installed pnpm 12.23.0 but warned that its install scripts are not covered by allowScripts. pnpm still answered pnpm -v afterwards, so the warning is about the new script policy in npm, not a failed install. If you want the scripts to run, the last warning line gives the exact command.
npm warn install-scripts 1 package has install scripts not yet covered by allowScripts:
npm warn install-scripts [email protected] (preinstall: node install.js; postinstall: node install.js)
npm warn install-scripts
npm warn install-scripts Run `npm install -g --allow-scripts=pnpm` to allow these scripts once, or `npm config set allow-scripts=pnpm --location=user` to allow them for all global installs.
Global packages are stored per Node version under fnm. A pnpm installed under Node 26 is therefore missing when a project switches you to Node 24, and the fix is to run the same npm install -g again while that version is active.
How do you install Java and set JAVA_HOME on a Mac?
Install Eclipse Temurin from Homebrew casks and point JAVA_HOME at it with /usr/libexec/java_home. A fresh Mac has no JDK at all, and java -version only prints “Unable to locate a Java Runtime.” For most people Java 25, the current LTS, is the right default, with Java 21 added for builds that have not moved yet.
brew install --cask temurin@25
brew install --cask temurin@21
/usr/libexec/java_home -V
Each cask runs Apple’s installer with sudo, so expect a password prompt. Skip the plain temurin cask unless you want the newest non-LTS release. We installed it as well, and it immediately became the default because java_home prefers the highest installed version, which is how a Mac quietly ends up building on a short-lived JDK. Pick a JDK by major version and export it.
export JAVA_HOME=$(/usr/libexec/java_home -v 25)
echo $JAVA_HOME
java -version
The java in /usr/bin is a launcher that reads JAVA_HOME, so changing one variable switches the whole toolchain, Maven and Gradle included. Switching to 21 is the same export with -v 21, and the capture shows both switches against three installed JDKs. In it, check these:
/usr/libexec/java_home -Vlists every Temurin JDK under/Library/Java/JavaVirtualMachines.echo $JAVA_HOMEends intemurin-25.jdk/Contents/Homeafter the-v 25export.java -versionprints an LTS build string that matches the version you exported.

Note the last line of the -V output: with no version asked for, java_home returns the highest JDK, which was Temurin 27 here.
Why does java_home -v 17 return a different JDK?
Because java_home falls back to the default JDK when the version you ask for is not installed, and it still exits 0. We asked for 17 on a Mac with only 21, 25 and 27, and got the Temurin 27 path back with no error. A build script that sets JAVA_HOME that way then compiles against the wrong JDK and fails much later, usually with a class file version error. Add -F to make the lookup fail instead.
/usr/libexec/java_home -F -v 17; echo $?
With -F the lookup prints “Unable to locate a Java Runtime that supports (null).” and returns exit code 1, so a script running under set -e stops right there. A trailing plus, as in -v 21+, means “this or newer” and returned 27 on our Mac.

Use -F in CI scripts and Makefiles, where a wrong JDK is worse than no JDK. In an interactive ~/.zshrc the fallback is the friendlier choice, since a new terminal still gets a working Java after you uninstall the JDK it named.
How do you install PostgreSQL on a Mac?
Install a versioned formula such as postgresql@18 and start it with brew services. The version in the name matters, because a major PostgreSQL upgrade needs pg_upgrade on the data directory. An unversioned formula could jump majors during a routine brew upgrade and leave a cluster the new server refuses to open. brew search postgresql@ listed 13 through 19 on our run, and 18 is the line we use here.
brew install postgresql@18
psql --version
The formula runs initdb for you and creates a cluster owned by your macOS user. Two lines from the end of that output are worth reading before you continue.
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
🍺 /opt/homebrew/Cellar/postgresql@18/18.7: 3,883 files, 79.4MB
Trust authentication means any local user can connect as any role without a password. That is normal for a laptop database and wrong for anything reachable from a network, so keep the default localhost listener and never expose this cluster. Never copy this pg_hba.conf to a server, where password authentication with scram-sha-256 is the norm and trust would let anyone with a shell in as any role. The install also set up three things you can check:
- The data directory is
/opt/homebrew/var/postgresql@18, owned by your macOS user. psql --versionanswers with no PATH edit, because Homebrew linkedpsqlandcreatedbinto/opt/homebrew/bineven thoughbrew infocalls the formula keg-only. If anotherpostgresql@version was already installed, only names likepsql-18get linked, so runbrew link postgresql@18after unlinking the old one.- Your macOS user name is also the database superuser name.
Start the service: brew services error 125 over SSH
Homebrew’s caveat tells you to run brew services start postgresql@18, which registers a LaunchAgent that starts at login. That agent belongs to your desktop login session. We ran the setup over SSH with no one logged in at the screen, the same situation as a remote Mac mini or a cloud Mac, so the start failed.
Could not enable service: 125: Domain does not support specified action
Error: Failure while executing; `/bin/launchctl enable gui/501/sh.brew.postgresql@18` exited with 125.
Error 125 means the gui/501 launchd domain does not exist, because user 501 has no desktop session. On a headless Mac, start PostgreSQL as a system LaunchDaemon that still runs as your own user, so the data directory permissions stay correct.
sudo brew services start --sudo-service-user $USER postgresql@18
sudo brew services list
pg_isready
The capture shows the failed start and the fix in one session. The plist lands in /Library/LaunchDaemons, pg_isready flips from “no response” to “accepting connections”, and the server now starts at boot rather than at login. If you sit at the Mac and log in normally, the plain command from the caveat is all you need.

A daemon started with sudo only shows up in sudo brew services list, since the plain list reads your user’s agents. Stop it the same way, with sudo brew services stop postgresql@18.
Create a database and an app role
Your macOS user is already a superuser in this cluster, so createdb works straight away. Give the application its own login role anyway, because then its connection string looks like the one it will use in production, even though trust auth does not check the password locally.
createdb app_dev
psql app_dev
Inside psql, create the role and let it create objects in the public schema. PostgreSQL 15 and later no longer grant CREATE there to every role by default, so skipping the grant leaves the app unable to create tables.
create role app with login password 'devpass';
grant all on schema public to app;
\conninfo
\q
The \conninfo table confirms the socket directory, the port and the superuser flag. Read it once now, so a later connection error has a known baseline.
Connection Information
Parameter | Value
----------------------+----------
Database | app_dev
Client User | ec2-user
Socket Directory | /tmp
Server Port | 5432
Options |
Protocol Version | 3.0
Password Used | false
GSSAPI Authenticated | false
Backend PID | 9173
SSL Connection | false
Superuser | on
Hot Standby | off
(12 rows)
Your client user will be your own login name rather than ec2-user. The socket sits in /tmp on port 5432, which is where most drivers look by default on macOS. If another PostgreSQL such as Postgres.app already holds 5432, the Homebrew server cannot bind the port and fails to start, so quit the other one before running the service command.
Do the pieces work together?
Yes, and one query from the uv project proves Python, the driver and the database in a single step. From the folder that holds hello-api, step into the project, add psycopg and connect as the app role over TCP.
cd hello-api
uv add "psycopg[binary]"
uv run python -c "import psycopg; print(psycopg.connect('postgresql://app:devpass@localhost/app_dev').execute('select current_user, version()').fetchone())"
The row came back with app as the current user and the Homebrew build string, so the role, the TCP listener and the Apple Silicon wheel all work. The [binary] extra matters here. Without it, psycopg looks for a system libpq at runtime, and you end up chasing a library path instead of writing code.

A Node or Java app connects the same way, with postgresql://app:devpass@localhost/app_dev as the URL for the pg driver or jdbc:postgresql://localhost/app_dev for JDBC. Only the host, role and password in that URL change between your laptop and a real server.
How do you make the setup survive a new terminal?
Add three settings to ~/.zshrc, namely the uv bin directory, the fnm hook and a default JAVA_HOME. Homebrew’s own shellenv line normally lives in ~/.zprofile already, and PostgreSQL needs nothing because its tools are linked into /opt/homebrew/bin. Open the file in your editor.
vim ~/.zshrc
Append this block, which is the exact file we loaded into a fresh zsh for the check below. Paste it at the end of the file so it runs after anything else that edits PATH.
# uv tools and the uv-managed python3
export PATH="$HOME/.local/bin:$PATH"
# fnm: pick the Node version from .node-version or .nvmrc on cd
eval "$(fnm env --use-on-cd --shell zsh)"
# Java 25 LTS as the default JDK
export JAVA_HOME=$(/usr/libexec/java_home -v 25)
Order matters for the first setting. Putting ~/.local/bin in front is what makes python3 resolve to the uv interpreter rather than Homebrew’s, so if you move it after Homebrew, the Homebrew Python comes back. Drop the line entirely and every uv tool command such as ruff stops being found as well. If you use Oh My Zsh, add the block after the line that sources it, as set up in our zsh and Oh My Zsh on macOS guide.
Open a new terminal and ask each tool where it lives and which version it runs. A terminal that was already open still has the old PATH, so it proves nothing.
which python3 node java psql
python3 --version; node -v; psql --version
java -version
echo $JAVA_HOME
Every answer came from the manager we set up. Python resolved to ~/.local/bin, Node to an fnm shell, and Java to Temurin 25 through the launcher, while psql stayed on the Homebrew link.

Homebrew auto-updates before every install, which can slow a quick brew install on a busy morning. Turning off Homebrew auto-update is safe with this setup, because the runtimes are pinned by their managers rather than by Homebrew. For what changed underneath these tools in the current macOS release, read our macOS Golden Gate notes for developers.
Is your Mac ready? Run this checklist
Work through the list in a new terminal. Each line is something you can confirm with one command, and the first one that fails points at the section to revisit.
which python3prints a path under~/.local/bin, not/opt/homebrew/bin.uv run python --versioninside a project matches its.python-versionfile.which nodepoints into anfnm_multishellsdirectory.- Entering a folder with a
.node-versionfile prints “Using Node” and the pinned version. echo $JAVA_HOMEends in the Temurin JDK you chose, andjava -versionagrees with it./usr/libexec/java_home -F -v 25; echo $?prints the JDK path and 0.pg_isreadyreports/tmp:5432 - accepting connections.psql app_dev -c 'select 1'returns one row without a password prompt.
Once all eight pass, the Mac is ready for real projects. From here on, each new project only needs its own version file or JAVA_HOME line rather than another global install, and that is what keeps this setup working through the next round of releases.