Getting Started
Installing Homebrew for macOS
Section titled “Installing Homebrew for macOS”Homebrew is a popular package manager for macOS. To install Homebrew, run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Node.js
Section titled “Node.js”Fast Node Manager (fnm)
Section titled “Fast Node Manager (fnm)”Fast Node Manager (fnm) is a simple and fast Node.js version manager.
Installing fnm
Section titled “Installing fnm”To install fnm with Homebrew, run the following command:
brew install fnmNow, add the following lines to your ~/.zshrc file:
eval "$(fnm env --use-on-cd --shell zsh)"Commands
Section titled “Commands”To see a list of all commands for fnm, use:
fnm help| Command | Description |
|---|---|
fnm list-remote | List all remote Node.js versions [aliases: ls-remote] |
fnm list | List all locally installed Node.js versions [aliases: ls] |
fnm install <version> | Install a Node.js version [aliases: i] |
fnm install --lts | Install the latest stable version of Node.js [aliases: i] |
fnm use <version> | Change Node.js version |
fnm default <version> | Set a version as the default version |
fnm current | Print the current Node.js version |
fnm uninstall <version> | Uninstall a Node.js version [aliases: uni] |
fnm help | Print this message or the help of the given subcommand(s) |
To check the installed Node.js version, run the following command:
node --versionOfficial Node.js Installer
Section titled “Official Node.js Installer”Alternatively, you can download the official Node.js installer from the Node.js website.
Bun is a fast, incrementally adoptable all-in-one JavaScript, TypeScript & JSX toolkit. Use individual tools like bun test or bun install in Node.js projects, or adopt the complete stack with a fast JavaScript runtime, bundler, test runner, and package manager built in. Bun aims for 100% Node.js compatibility.
Installing Bun
Section titled “Installing Bun”To install Bun run the following command:
curl -fsSL https://bun.com/install | bashbrew install oven-sh/bun/bunTo check that Bun was installed successfully, open a new terminal window and run:
bun --version# Output: 1.x.y
# See the precise commit of `oven-sh/bun` that you're usingbun --revision# Output: 1.x.y+b7982ac13189Adding Bun to your PATH
Section titled “Adding Bun to your PATH”-
Determine which shell you’re using:
Terminal window echo $SHELL# /bin/zsh or /bin/bash or /bin/fish -
Open your shell configuration file:
- For
bash:~/.bashrc - For
zsh:~/.zshrc - For
fish:~/.config/fish/config.fish
- For
-
To add the Bun directory to
PATH, add this line to your configuration file:Terminal window export BUN_INSTALL="$HOME/.bun"export PATH="$BUN_INSTALL/bin:$PATH" -
Reload your shell configuration:
Terminal window source ~/.bashrc # or ~/.zshrc or ~/.config/fish/config.fish
Upgrading Bun
Section titled “Upgrading Bun”Once installed, the binary can upgrade itself:
bun upgrade