How to Install Deno 2.0 on macOS, Windows, and Linux
Deno 2.0 is a modern runtime for JavaScript and TypeScript, designed for security, TypeScript support, and compatibility with Node.js. In this guide, you’ll learn how to install Deno 2.0 on macOS, Windows, and Linux. Additionally, we’ll cover multiple installation options for each operating system so you can choose the best method for your setup.
Installation on macOS
For macOS users, Deno 2.0 can be installed using either Homebrew or a shell script.
Method 1: Using Homebrew (Recommended)
Homebrew is a popular package manager for macOS, making it easy to install and manage Deno.
-
Open Terminal: Use Spotlight (Command + Space) to open Terminal.
-
Install Homebrew (if not installed): If you don’t have Homebrew, install it with:
-
Install Deno: Once Homebrew is installed, install Deno with the following command:
-
Verify Installation: Check that Deno was installed successfully by running:
You should see Deno’s version number, which confirms the installation.
Method 2: Using Shell Script
Alternatively, you can install Deno using a shell script, which is useful if you don’t want to install Homebrew.
-
Run the Installation Script: In Terminal, execute:
-
Add Deno to Your PATH: If Deno isn’t automatically added to your PATH, add it manually by updating your shell profile (
~/.zshrc
,~/.bash_profile
, or~/.bashrc
): -
Verify Installation: Run the following command to confirm Deno is correctly installed:
Installation on Windows
Windows users have multiple options for installing Deno 2.0, including PowerShell, Scoop, and Chocolatey. We’ll go through each method below.
Method 1: Using PowerShell (Direct Installation)
-
Open PowerShell: Open PowerShell as Administrator by pressing
Win + X
and selecting “Windows PowerShell (Admin)”. -
Run the Installation Script: Execute the following command in PowerShell to download and install Deno:
-
Verify Installation: Once the installation completes, confirm it by running:
Method 2: Using Scoop (Recommended for Frequent Users of Windows CLI)
Scoop is a package manager for Windows that simplifies the installation of software.
-
Install Scoop (if not installed): In PowerShell, run:
-
Install Deno: Once Scoop is set up, install Deno with:
-
Verify Installation:
Method 3: Using Chocolatey
Chocolatey is another package manager for Windows, which is also commonly used for managing dependencies.
-
Install Chocolatey (if not installed): In PowerShell (Admin), install Chocolatey with the following commands:
-
Install Deno: Once Chocolatey is ready, install Deno:
-
Verify Installation:
Installation on Linux
Linux users can install Deno using a shell script, package managers, or directly from the source. Here’s how to proceed with each option.
Method 1: Using Shell Script (Recommended)
This is the most straightforward method and works across various Linux distributions.
-
Open Terminal.
-
Run the Installation Script:
-
Add Deno to Your PATH: If Deno isn’t added automatically, update your shell profile (
~/.bashrc
or~/.zshrc
): -
Verify Installation:
Method 2: Using APT (For Debian/Ubuntu-Based Systems)
For Debian or Ubuntu users, Deno can also be installed via APT after adding the official Deno repository.
-
Add Deno Repository:
-
Verify Installation:
Method 3: Using Yum (For Fedora/CentOS-Based Systems)
For Fedora and CentOS, you can install Deno with Yum.
-
Add Deno Repository:
-
Verify Installation:
Alternative Installation Methods
Deno can also be installed on specific platforms using the following tools:
-
Nix (macOS and Linux):
-
Install from Source (For Advanced Users): You can also clone and build Deno directly from the source. Visit the Deno GitHub repository for instructions on building Deno from source.
Summary
Deno 2.0 offers cross-platform support and is straightforward to install on macOS, Windows, and Linux. Here’s a quick overview of installation methods:
- macOS: Install via Homebrew or shell script.
- Windows: Use PowerShell, Scoop, or Chocolatey.
- Linux: Install with a shell script, or package managers like APT for Ubuntu/Debian or Yum for Fedora/CentOS.
Each method provides a reliable way to install Deno, allowing you to leverage this secure, modern runtime across different environments and start developing applications with JavaScript or TypeScript quickly.